Comments
9 comments
-
Hi,
Here are some ideas:
It could be a clash between your error handling code and the error handling code inserted by SmartAssembly. Is your code still implementing an unhandled exception handler ?
Or it could be related to multiple app domains. Are you using multiple app domains?
Can you throw some simple exceptions elsewhere in your code ? Are any of these reported correctly ?
Is it possible you are using a build script which uses an older saproj that does not have error reporting turned on. -
james.davies wrote:Hi,
Here are some ideas:
It could be a clash between your error handling code and the error handling code inserted by SmartAssembly. Is your code still implementing an unhandled exception handler ?Or it could be related to multiple app domains. Are you using multiple app domains?Can you throw some simple exceptions elsewhere in your code ? Are any of these reported correctly ?Is it possible you are using a build script which uses an older saproj that does not have error reporting turned on. -
james.davies wrote:Or it could be related to multiple app domains. Are you using multiple app domains?
Our app runs something like this:Sub Main fSplash = New frmSplash fSplash.Show() ' program initialisation code goes here (open DB connection, etc.) System.Windows.Forms.Application.Run(fSplash) Do While fSplash.IsLoggedIn fSplash = Nothing fMDI = New frmMDI System.Windows.Forms.Application.Run(fMDI) If fMDI.IsExitingApp Then Exit Do fMDI = Nothing fSplash = New frmSplash fSplash.Show() System.Windows.Forms.Application.Run(fSplash) Loop End Sub
My experiments showed that any exceptions thrown before the call to System.Windows.Forms.Application.Run(fMDI) would be caught by the SA UnhandledException handler, but after that they would be dealt with by the default Winforms handler. -
I have created a minimal project that reproduces the problem I have encountered. It can be downloaded from here.
You will notice that a click on the Throw Exception button on the "Splash" form, the first time it is opened, results in the standard SmartAssembly error window popping up, but a click on the Throw Exception menu item in the MDI or a click on the Throw Exception button on the Splash window after logging in and back out again, results in the default Windows Forms exception window. -
Error reporting uses the standard application message loop.
It seems that extra calls to Application.Run() cause a problem with this.
It could be that calls to Application.Run() start a new message loop and SA is hooked into the old one causing the exceptions to not be reported.
Thanks for the reproduction of the problem. I will add this to our bug tracking system and see what the developers say. -
Has any progress been made on getting SA to cope with this scenario?
-
[bump] Anything?
-
There are no comments yet from the developers on this bug. I will try to get them to take a look.
-
(Have heard from developer regarding this:)
This problem is because the current thread context (which is where the unhandled exception handler gets attached) is completely removed at the end of the Application.Run method.
Please use Form.Show instead of Application.Run - http://social.msdn.microsoft.com/Forums/en-us/winforms/thread/aead5e9a-2e06-4adf-aecc-f45a2a633768
Add comment
Please sign in to leave a comment.
I have spent the past 30 months migrating our big VB6 application to VB.NET. We had produced our own tool for augmenting the code in the VB6 project with error handling and reporting, so rather than trying to get that working in .NET too, we thought it would be easier and faster to investigate third-party tools to do the job and SA was first on the list.
After some initial false starts I've managed to process the WinForms application assembly and get a new assembly that runs ok and lets me get into testing the results. I have been able to generate an unhandled exception from our app that looks to be the result of a late-bound call which now fails because of obfuscated method names not being what it is expecting.
The problem is that I was expecting this to be handled by the standard template provided by SmartAssembly, but instead I get the regular WinForms unhandled exception dialogue box. I have my SA project set with the "I want errors reported in my application" option selected.
Obviously I am going to have to change the code so that the call is no longer late-bound, but before I worry about that I want to be sure that the error reporting is sending reports back to me of any problems encountered.
What am I missing?