getsentry / sentry-dotnet

Sentry SDK for .NET
https://docs.sentry.io/platforms/dotnet
MIT License
599 stars 206 forks source link

Fix: ArgumentNullException in FormRequestPayloadExtractor when handling invalid form data on ASP.NET #3734

Closed jamescrosswell closed 1 week ago

jamescrosswell commented 2 weeks ago

Resolves https://github.com/getsentry/sentry-dotnet/issues/3701

Analysis

This is handled differently in ASP.NET vs ASP.NET Core.

In ASP.NET Core, the implementation for IHttpRequest is: https://github.com/getsentry/sentry-dotnet/blob/263961124a49c5fa8290c8721294e7fd472e7027/src/Sentry.AspNetCore/HttpRequestAdapter.cs#L16-L18

In ASP.NET the implementation is: https://github.com/getsentry/sentry-dotnet/blob/e75d537c14ded617c99eb33f19cf4ce69ca4de36/src/Sentry.AspNet/Internal/SystemWebHttpRequest.cs#L15-L16

Seemingly it's only a problem in ASP.NET... pushing an initial PR so I can switch to my windows box for development.