I have a C# Application with a C++ component. I am communicate with DllImport between the modules. The Application works for many days without a problem and crash sometime unexpectedly.
[DllImport("recorder", CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr start_recording();
Is it possible to run the C++ part in a protected container so that not the whole application crashes?
Event Viewer
Application Error
Faulting application name: Recorder.exe, version: 1.0.0.0, time stamp: 0x59eef7cb
Faulting module name: avformat-57.dll, version: 57.71.100.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x00000000000d7e7f
Faulting process id: 0x186c
Faulting application start time: 0x01d3620b7e41ef96
Faulting application path: C:\Test\Recorder.exe
Faulting module path: C:\Test\avformat-57.dll
Report Id: 3fde49fc-d2ed-11e7-bf5c-002590abb7d4
.NET Runtime
Application: Recorder.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: exception code c0000005, exception address 000007FEEA407E7F
Generally, there are some conditions which will always cause a process to exit and you have nothing to do with it.
While you can handle some errors with catching exceptions, setting signal handler, or just fixing the bug, this will fix only a specific case, and will not give you a general solution, and it is possible you don't have control over the module at all.
The common solution in such a case is to separate the module into a different proxy process, which will communicate with your own application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With