Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Glimpse.AspNet is incompatible with Sentry #1025

Open
RudeySH opened this issue May 28, 2019 · 0 comments
Open

Glimpse.AspNet is incompatible with Sentry #1025

RudeySH opened this issue May 28, 2019 · 0 comments

Comments

@RudeySH
Copy link

RudeySH commented May 28, 2019

While using Sentry, Glimpse.AspNet and Newtonsoft.Json.Glimpse, I ran into an issue where Sentry was unable to capture messages or exceptions. Take a look at the following stacktrace:

Exception thrown: 'System.NullReferenceException' in Glimpse.AspNet.dll
Error while processing event d3eae076461d4f7982837387f5c9ea7a: System.NullReferenceException: Object reference not set to an instance of an object.
   at Glimpse.AspNet.AspNetFrameworkProvider.get_HttpRequestStore()
   at Glimpse.Core.Framework.Factory.<>c__DisplayClass5.<InstantiateRuntimePolicyStrategy>b__4()
   at Newtonsoft.Json.Glimpse.JsonSerializerSettingsFactory.IsGlimpseEnabled()
   at Newtonsoft.Json.Glimpse.JsonSerializerSettingsFactory.GetDefaultSerializerSettings()
   at Newtonsoft.Json.JsonSerializer.CreateDefault()
   at Newtonsoft.Json.JsonSerializer.CreateDefault(JsonSerializerSettings settings)
   at Sentry.Internal.JsonSerializer.SerializeObject[T](T object)
   at Sentry.Internal.Http.HttpTransport.CreateRequest(SentryEvent event)
   at Sentry.Internal.Http.HttpTransport.<CaptureEventAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Sentry.Internal.BackgroundWorker.<WorkerAsync>d__14.MoveNext(). #0 in queue.
Exception thrown: 'System.NullReferenceException' in Glimpse.AspNet.dll

If I had to guess, it seems Sentry wants to serialize something which triggers Newtonsoft.Json.Glimpse to check if Glimpse is enabled, but at this point in time HttpRequestStore is null, causing Glimpse.AspNet to throw an exception.

At first I thought this was a Sentry issue, see getsentry/sentry-dotnet#206

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant