My company uses madExcept within our web applications and I've been having problems getting the exceptions emailed to us when used in a .exe web application. Our website uses both a .exe and an ISAPI .dll, and we've got the same madExcept settings setup in both. The .dll worked great with madExcept immediately, but in the .exe the bug report is generated and shown on screen but the email was not being sent.
I managed to track this down to an issue that the .exe thought it had finished all it's work, since the main thread was no longer running, so was being freed from memory before madExcept had time to actually send the email. In the end I have got it working but not with a very elegant solution and I think there must be a better way.
In the main project source for the application there are these 3 lines which are auto-generated when you create the project:
Code: Select all
Application.Initialize; Application.WebModuleClass := WebModuleClass; Application.Run;
Code: Select all
while Application.ActiveCount > 0 do Sleep(100); if madexcept.AmOnline then Sleep(2000);
The other thing I tried was using the OnException event in my TWebApplication to call HandleException manually. I think I'd still have to use Sleep after calling it to ensure the thread doesn't "finish" before madExcept has a chance to, but I don't think this can work since madExcept catches all uncaught exceptions before they make it to the OnException event. I was looking for a way to have madExcept enabled so that I can call HandleException but not automatically catch uncaught exceptions, but this doesn't seem to be possible?