Null Exception on AddAspNet
See original GitHub issuePackage
Sentry.AspNet
.NET Flavor
.NET
.NET Version
4.7
OS
Windows
SDK Version
3.20.1
Self-Hosted Sentry Version
No response
Steps to Reproduce
I was trying to figure out how to support Transactions for a OWIN application but it seems like when adding the AddAspNet
to the code it throws a nullexception error.
The only plausible cause is the HttpContext being null here: https://github.com/getsentry/sentry-dotnet/blob/main/src/Sentry.AspNet/Internal/SystemWebVersionLocator.cs#L20
Expected Result
AddAspNet to not throw a null Exception
Actual Result
There are no line numbers :\
at Sentry.AspNet.Internal.SystemWebVersionLocator.Resolve(HttpContext context)
at Sentry.AspNet.SentryAspNetOptionsExtensions.AddAspNet(SentryOptions options, RequestSize maxRequestBodySize)
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
I am getting null pointer exception in asp.net application
It works flawlessly in test environment, however, I am getting null reference exception in real server. I am using ninject.
Read more >Why am I getting a null reference exception for ASP.NET ...
Because houseNo is null in this case, the value from the database is not retrun a value (null). When binding the model (@默...
Read more >NullReferenceException Class (System)
The exception that is thrown when there is an attempt to dereference a null object reference.
Read more >Rotativa Cannot perform runtime binding on a null reference ...
Answer. The error indicates that you haven't configured Rotativa. Configuration your application like this: public void Configure(IApplicationBuilder app, ...
Read more >Migration Guide for .NET
Upgrading includes both breaking changes and new features. Migrating to 3.12.0. NuGet Changes. If you're using the Sentry.EntityFramework NuGet package ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lucas-zimerman - Once this gets released (or if you want to do a custom build now), please let us know if Simon’s change in #1881 solved the issue. I’ll leave this open until you can check. Thanks.
looking at the code in question
the only way i can see a null ref is if
HttpContext
is null. googling around there seems to be many scenario whereHttpContext.Current
can be null. givenSystemWebVersionLocator.Resolve
seems to be “best effort” at finding version. do we add a null check and return null?