getsentry / sentry-dotnet

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

ArgumentNullException at FormRequestPayloadExtractor #3701

Closed christianklotz85 closed 1 day ago

christianklotz85 commented 3 weeks ago

Package

Sentry.AspNet

.NET Flavor

.NET

.NET Version

4.7.2

OS

Windows

SDK Version

3.41.4 and 4.12.0

Self-Hosted Sentry Version

No response

Steps to Reproduce

The problem is that the body is not valid. The & at the end is not valid. But some of our API clients send the request in this format. Valid would be " "x=1&y=2".

Expected Result

Successful capture and sending of the event to Sentry server.

Actual Result

The sentry event is not send to server.

If you enable Debug option you can find this in the logs:

Error: An error occurred when capturing the event 5bc6bf3280ee4952850c65139f5d1f8a.

System.ArgumentNullException: Der Wert darf nicht NULL sein. Parametername: key bei System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) bei System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer`1 comparer) bei Sentry.Extensibility.FormRequestPayloadExtractor.DoExtractPayLoad(IHttpRequest request) bei Sentry.Extensibility.BaseRequestPayloadExtractor.ExtractPayload(IHttpRequest request) bei Sentry.Extensibility.RequestBodyExtractionDispatcher.ExtractPayload(IHttpRequest request) bei Sentry.AspNet.Internal.SystemWebRequestEventProcessor.Process(SentryEvent event) bei Sentry.SentryClient.DoSendEvent(SentryEvent event, SentryHint hint, Scope scope) bei Sentry.SentryClient.CaptureEvent(SentryEvent event, Scope scope, SentryHint hint)Info

A NullPointer in FormRequestPayloadExtractor happens.

jamescrosswell commented 3 weeks ago

Thanks for the detailed report @christianklotz85 - we'll see if we can reproduce and look into it.