How do I protect my C# app from crashing when calling a method in an unmanaged DLL?
I have an unmanaged DLL written by another developer in unmanage开发者_如何学God C++. My application is a WinForms application written in C#. I am using interop to call a method (function) in the native DLL. The call is causing my application to crash upon executing the method.
How does one safely call a method using interop, so that it does not bring the app down?
You could create a seperate AppDomain and load the unmanaged DLL in it. If the call crashes, it will just crash the AppDomain and your application will still live
精彩评论