Closed knumat closed 9 months ago
Hi @knumat
Thank you for the PR we will updater this thread once we have had a chance to review the changes.
Regards, Mitchell.
This will be resolved in #518 by using IHttpContextAccessor and passing the info in rather than attempting to store the data locally in the RaygunClient (RaygunClient should be treated as a singleton)
This caused a subtle bug where the first exception reported would include the request context, but subsequent exceptions would not.
In addition, the AspNetCore version would never set the StatusCode or StatusDescription in the Response since _currentHttpContext was set to null by BuildRequestMessage() just before BuildResponseMessage() was called. Note that StatusCode would not typically be set if an exception occurred on ASP.NET Core since the Raygun HTTP module does not exist on this platform, but custom middleware might want to do this. For example, custom middleware might watch for certain HTTP status codes and report them.
As long as RaygunClient objects are short-lived, this should not cause any memory leaks.