As a proof-of-concept, I have created a sandbox WinForms application, that when a button is pressed, the event handler code is thus:
- Code: Select all
Marshal.StructureToPtr(new Point(), new IntPtr(-1), false);
This is to force an AccessViolationException to see whether the exception report would show the memory address and instruction address from the exception.
After SmartAssembly processes the application instead of a SmartAssembly dialog, the application immediately terminates (or shows the default Windows error reporting dialog).
I've also tried explicitly catching the AccessViolationException and using
the ExceptionReporting.Report(Exception) method to report it manually, to no avail.
It only seems to report the exception if I throw the AccessViolationException manually (which doesn't let me see the private fields containing the memory address and the instruction address), but that's obviously no good in practice.
Is there a reason why this isn't working? I want to be able to generate exception reports for AccessViolationExceptions so that if a crash occurs in a native component called via Inteop we can diagnose the issue in the native code to some degree via the managed exception reports.
Even without the detailed information about the AccessViolationException, even the fact that one happens appears to be completely missed by the SmartAssembly error handling.