Today is my first day at trying out using Smart Assembly, so I could potentially be doing something really silly, but if I am then I can't see it.

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.

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 ?

We did have a very basic one in the earlier stages of the migration, as a placeholder for when we were still considering doing our own error reporting system, but this has all been removed from the project now.

Or it could be related to multiple app domains. Are you using multiple app domains?

Not intentionally. Is there anything in the .NET framework classes used to support code migrated from VB6 that could be doing so behind the scenes?

Can you throw some simple exceptions elsewhere in your code ? Are any of these reported correctly ?

I just added one right at the beginning of the Main() method and it was handled correctly. I will try adding more around the area where it is not reporting them correctly to see if that provides any more clues as to what is going awry.

Is it possible you are using a build script which uses an older saproj that does not have error reporting turned on.

No, we're not using a build script yet. I'm still using the tools interactively at this stage.

james.davies wrote:Or it could be related to multiple app domains. Are you using multiple app domains?

While I'm fairly certain that we're not using multiple app domains, we might be doing something a little different with the message loop from the standard Winforms app, by having multiple calls to System.Windows.Forms.Application.Run() for when we have different forms as the main window of the app at different stages.

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.