I am currently integrating Sentry into a .NET Core 3 app - it’s set up and working and errors are correctly being logged
When an error is encountered I am using UseExceptionHandler("/Home/Error") to redirect the user to a nicer error page which basically says something went wrong. To assist in debugging, we also include a link straight back to the Sentry issue so that one of our helpdesk team can connect to that users PC, go straight to the Sentry issue caused by the error they just had and look at what went wrong.
In order to do this we use the LastEventId method, and this works well most of the time. However sometimes it seems like the Sentry issue isn’t actually created until AFTER the Home/Error page is loaded (meaning that LastEventId returns as 0 and obviously it’s then too late to give any context to the error page). This seems to be when a fatal error occurs (a contrived example is below)
(As I say the error IS captured in both instances by Sentry but in the first case only after the page has loaded)
In theory we could manually create a Sentry event from the Error controller that we link back to but this seems a bit counter intuitive as much of the useful logging info will be missing and we will be “doubling up” on the log.
Could anyone advise how I can get Sentry to create the event (and hence have a LastEventId) before the .NET Exception Handler takes over. Any help would be very much appreciated!!