Start a new topic

Loupe not getting handled/unhandled exceptions

Trying Loupe in my WinForms MDI application.  I can't seem to get it to implicitly pickup handled or unhandled exceptions (I get the standard exception dialog, not the Loupe Error Manager dialog).  It will log entries if I explicitly call Log methods and will also work if I explicitly call Log.ReportException, so I think I have it integrated correctly.  I've even explicitly set both CatchUnhandledExceptions and ReportErrorsToUser to true (even that appears to be the default).


Any ideas what could cause this behavior or am I missing something?


There are a few possibilities.


The first thing is to be sure you're starting the Loupe Agent early on in your application's lifecycle - it doesn't bind to the events necessary to capture that information until the agent is started.  The recommended spot to call StartSession is noted in this section of the doc:
http://www.gibraltarsoftware.com/Support/Loupe/Documentation/WebFrame.html#WinForms_DevelopersReference_EnsureAgentLoaded.html 


The second thing is that if you have created a second windows message pump then you'll need to call a method to bind it - So for example if you start a windows form on a background thread or enter a new application context (like after using a start menu).  All you have to do is call this method to register UI bindings on that thread (Safe to call multiple times):

http://www.gibraltarsoftware.com/Support/Loupe/Documentation/WebFrame.html#Gibraltar.Agent~Gibraltar.Agent.Log~RegisterUIThread.html


The third thing is if you register your own Application unhandled exception handler that will "kick out" the one Loupe registers - there can only be one.


Finally, if you're testing this within the Visual Studio debugger, note that will tend to break on the error even if things are correctly set up.


Thanks!


I have the Loupe Agent initializing and doing a Log.StartSession() in the Program class before calling Application.Run.


I added the Log.RegisterUIThread() to the main (MDI) form initializer and that seemed to do the trick.

Login to post a comment