c++ - Unhandled Exceptions from Managed C# User Control used in MFC Dialog -
Our main application is built in MFC C ++, but we are trying to write new code in .NET , And a user has been created will be used on existing MFC dialogue.
However, when an unexpected / uncontrolled exception is removed from user control, it crashes the MFC app (illegal session style), there is no merit to recover.
I have added
AppDomain currentDomain = AppDomain.CurrentDomain; CurrentDomain.UnhandledException + = new unrestricted expansion event handler (currentDomain_UnhandledException); Application.ThreadException + = New ThreadExpress Event Handler (Application_ThreadException);
For NET user control creator, but it seems to catch nothing.
Is there any way to add an event to the MFC to handle them?
Quick Google does not return anything useful
Thank you.
Edit: Even then the way I want it is not able to solve it, the way to do it is the best , all the NIT codes, So there is no exception bubble.
I asked this same question some time ago:
What I've got This is that the managed unwanted exception event only operates on a managed thread, the fire only operates in WndProc, where the magic happens.
You have a few options: You can put low-level overrides in CWinApp and hold exceptions. It can be an unexpected side effect or you can go with Structured Exception Handling (SEH) which will give you a hack on all / uncontrolled exceptions. This is not an easy road.
Comments
Post a Comment