Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Captured exceptions not showing up when using Newtonsoft.Json.Glimpse #206

Closed
RudeySH opened this issue May 25, 2019 · 4 comments
Closed
Labels
Question Further information is requested

Comments

@RudeySH
Copy link

RudeySH commented May 25, 2019

I just spend a good amount of hours trying to figure out why captured exceptions from my ASP.NET app (MVC5) are not showing up in Sentry. After removing NuGet packages one by one, I came to the conclusion that Sentry stops working when Newtonsoft.Json.Glimpse is installed.

To reproduce this issue, take Sentry's EF sample or the "AspNetMvc5Ef6" sample, and install Newtonsoft.Json.Glimpse and Glimpse.AspNet (a third package Glimpse will be installed automatically). Run the sample and generate some exceptions, you'll notice these won't show up in Sentry.

@bruno-garcia
Copy link
Member

bruno-garcia commented May 27, 2019

I'm assuming this is a binding redirect issue. The version required by Glimpse and the Sentry SDK conflict and the one brought in ends up not working with the SDK somehow.
Could you please provide a repro? We'd need to set the SDK to Debug=true and see what it outputs.

Lates stable release of Glimpse is from 2014 so it's likely just incompatible.

By default the IDiagnosticLogger uses System.Console which won't work in classic ASP.NET. It'd required an instance that forwards calls to System.Diagnostics.Debug in order to see in the IIS express output window in Visual Studio.

@bruno-garcia bruno-garcia added the Question Further information is requested label May 27, 2019
@RudeySH
Copy link
Author

RudeySH commented May 28, 2019

Here's a GitHub repo that reproduces the issue: https://github.com/RudeySH/Sentry.Samples.AspNet.Mvc.Glimpse

It's a copy of Sentry.Samples.AspNet.Mvc with just the Glimpse NuGet packages installed. Note that even though Sentry.EntityFramework is being used in this sample, I've confirmed that Entity Framework is not part of the issue.

I've set Debug to true but I'm not sure what to do next.

@bruno-garcia
Copy link
Member

Thanks for the repro @RudeySH !
The debug output indicates:

Debug: Running processor on exception: Bad POST! See Inner exception for details.
Debug: Creating SentryStackTrace. isCurrentStackTrace: False.
Debug: Creating SentryStackTrace. isCurrentStackTrace: False.
Debug: Running main event processor on: Event d3eae076461d4f7982837387f5c9ea7a
Debug: Skipping request body extraction.
Warning: Ignoring request with Size 65 and configuration RequestSize None
Debug: Event queued up.
Exception thrown: 'System.NullReferenceException' in Glimpse.AspNet.dll
DebugException thrown: 'System.NullReferenceException' in Glimpse.AspNet.dll
: Exception thrown: 'System.NullReferenceException' in Glimpse.AspNet.dll
Event d3eae076461d4f7982837387f5c9ea7a in-flight to Sentry. #0 in queue.
Exception thrown: 'System.NullReferenceException' in Glimpse.AspNet.dll
Exception thrown: 'System.NullReferenceException' in mscorlib.dll
ErrorException thrown: 'System.NullReferenceException' in Glimpse.AspNet.dll
: 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

That the error is coming from Glimpse.
Please raise this with them although it seems the project hasn't been updated in years.

@RudeySH
Copy link
Author

RudeySH commented May 28, 2019

At first I wondered why an error in another dependency result in a complete loss of functionality of Sentry, all while Glimpse continues to work. That's why I submitted the issue here But now I see, Newtonsoft.Json.Glimpse breaks the JSON serializer, and there's not much Sentry can do about that.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants