Sentry.AspNetCore.Sentry middleware uses types that aren't present in .NET Core 3
See original GitHub issuePlease mark the type framework used:
- [x ] ASP.NET Core
Please mark the type of the runtime used:
- [x ] .NET Core
- Version: 3.0
Please mark the NuGet packages used:
- [ x] Sentry.AspNetCore
Sentry AspNetCore middleware crashes for .NET Core Web SDK application unconditionally:
System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.Internal.BufferingHelper' from assembly 'Microsoft.AspNetCore.Http, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at async Task Sentry.AspNetCore.SentryMiddleware.InvokeAsync(HttpContext context)
at void System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start<TStateMachine>(ref TStateMachine stateMachine)
at void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<TStateMachine>(ref TStateMachine stateMachine)
at Task Sentry.AspNetCore.SentryMiddleware.InvokeAsync(HttpContext context)
at Task Microsoft.AspNetCore.Hosting.HostingApplication.ProcessRequestAsync(Context context)
at async Task Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests<TContext>(IHttpApplication<TContext> application)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7 (4 by maintainers)
Top Results From Across the Web
ASP.NET Core
Easy ASP.NET Core integration, single line: UseSentry; Captures unhandled exceptions in the middleware pipeline; Captures exceptions handled by the ...
Read more >Can't add Sentry to ASP.NET Core Web API project in .NET 6
It seems that AddSentry is not recognized as an extension method of IServiceCollection . I have searched for similar issues and found some ......
Read more >Logging to Sentry in ASP.NET Core | by Martin Cerruti | Medium
We've set up a middleware component that allows all exceptions that aren't handled by user code to be reported directly to Sentry.
Read more >Logging in .NET Core and ASP.NET Core
Learn how to use the logging framework provided by the Microsoft.Extensions.Logging NuGet package.
Read more >Sentry.AspNetCore 3.35.1
Official ASP.NET Core integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.
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
This is still an issue: I use:
[x ] ASP.NET Core Please mark the type of the runtime used:
[x ] .NET Core Version: 3.1 Please mark the NuGet packages used:
[ x] Sentry 2.0.0-beta8
My code is: public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseSentry(); webBuilder.UseStartup<Startup>(); });
When I try to call a controller method I get: Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer: Error: Connection ID “18374686502757072928”, Request ID “80000021-0005-ff00-b63f-84710c7967bb”: An unhandled exception was thrown by the application.
System.TypeLoadException: Could not load type ‘Microsoft.AspNetCore.Http.Internal.BufferingHelper’ from assembly ‘Microsoft.AspNetCore.Http, Version=3.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’. at Sentry.AspNetCore.SentryMiddleware.InvokeAsync(HttpContext context) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Sentry.AspNetCore.SentryMiddleware.InvokeAsync(HttpContext context) at Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Hosting.HostingApplication.ProcessRequestAsync(Context context) at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync() Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 10.2048ms 500
@rfink The original issue was using Sentry 1.2.0 which is NOT compatible with .NET Core 3.1.
This comment is a different issue (uses Sentry 2.x and has different stack trace) which was raised on a separate issue #345 that was resolved.
I’m going to lock this issue since it’s a mess and the issue was resolved (Sentry 1.2 isn’t compatible with .NET Core 3).
Please raise a new issue with details of what’s going on and ideally share a link to a github repository which I can run and reproduces this issue.