Sentry.AspNetCore don't work on .NET Core 3 preview 7
Hey,
Today after update my project to .NET Core 3 preview 7 i got error after start server:
Microsoft.AspNetCore.Server.Kestrel[13]
=> RequestPath:/ RequestId:0HLOFIKBADKBP:00000001, SpanId:|21217a1d-4070281b8cc56ef0., TraceId:21217a1d-4070281b8cc56ef0, ParentId:
Connection id "0HLOFIKBADKBP", Request id "0HLOFIKBADKBP:00000001": 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.0.0.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.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
my Program.cs:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>()
.UseKestrel(
options =>
{
options.AllowSynchronousIO = true;
}).UseSentry();
});
I tried both versions:
<PackageReference Include="Sentry.AspNetCore" Version="1.2.0" />
<PackageReference Include="Sentry.AspNetCore" Version="2.0.0-beta2" />
Thanks for raising this! EnableRewind was under the Microsoft.AspNetCore.Http.Internal namespace so I'm guess this will be a won't fix from the ASP.NET team.
It seems like the middleware should be calling EnableBuffering instead though.
@bruno-garcia Thanks for fixing. Any planned release date for the bug fix?
@mrlife Just made a release: https://www.nuget.org/packages/Sentry/2.0.0-beta3 Please let us know if you find any issues.
Hi, I have the exact same issue, using Sentry.AspNetCore version 2.0.0-beta5. Is it still an issue? Or should I use version 2.0.0-beta3?
2019-10-30T09:39:26.321401674Z [40m [32minfo [39m [22m [49m: Microsoft.AspNetCore.Hosting.Diagnostics[1]
2019-10-30T09:39:26.321443374Z Request starting HTTP/1.1 GET http://my.application.net/
2019-10-30T09:39:26.323435869Z [41m [30mfail [39m [22m [49m: Microsoft.AspNetCore.Server.Kestrel[13]
2019-10-30T09:39:26.323455569Z Connection id "0HLQT2FRHKAGQ", Request id "0HLQT2FRHKAGQ:00000001": An unhandled exception was thrown by the application.
2019-10-30T09:39:26.323469069Z 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'.
2019-10-30T09:39:26.323474769Z at Sentry.AspNetCore.SentryMiddleware.InvokeAsync(HttpContext context)
2019-10-30T09:39:26.323491269Z at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
2019-10-30T09:39:26.323496469Z at Sentry.AspNetCore.SentryMiddleware.InvokeAsync(HttpContext context)
2019-10-30T09:39:26.323500969Z at Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.Invoke(HttpContext context)
2019-10-30T09:39:26.325408263Z at Microsoft.AspNetCore.Hosting.HostingApplication.ProcessRequestAsync(Context context)
2019-10-30T09:39:26.325424963Z at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2019-10-30T09:39:26.326097061Z [40m [32minfo [39m [22m [49m: Microsoft.AspNetCore.Hosting.Diagnostics[2]
2019-10-30T09:39:26.326111961Z Request finished in 2.0033000000000003ms 500
@nicolaigj We have apps using ASP.NET Core 3 and Sentry 2.0.0-beta4. beta5 came out a couple of days ago and shouldn't really affect this compatibility.
Could you please share a repro so we can investigate?
You should definitely update your documentation about ASP.NET Core 3, I've just lost 3 hours trying to configure Sentry following the official docs and having to deal with this known bug. Once I found this github issue I updated to 2.0.0-beta5 and it worked.
ASP.NET Core 3.0.0 introduced breaking changes. One of them broke the SDK. We plan to release 2.0.0 soon, sorry for the confusion.
Hi @bruno-garcia thanks for your response, I'm trying to include the request payload, I see that IncludeRequestPayload is deprecated so I'm using MaxRequestBodySize = RequestSize.Always as suggested. But I can't see the request payload, is anything more I'm missing?
@joalcava I've debugged through and it's indeed an issue. I've raised an issue, we'll tracked it here: https://github.com/getsentry/sentry-dotnet/issues/297
Please make comments on the other issue or raise a new one for anther topic, this one is regarding preview7 and has been closed already.