Skip to content

ArgumentNullException at FormRequestPayloadExtractor #3701

@christianklotz85

Description

@christianklotz85

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

  • Setup a C# .net Framwork 4.7.2 Web Api Project.
  • Add Sentry and Sentry.AspNet via Nuget Packages
  • Enable options.AddAspNet(Sentry.Extensibility.RequestSize.Medium)
  • Make a Api Request with ContentType "application/x-www-form-urlencoded" and body "x=1&y=2&"
  • Capture a Sentry Event at a methode called by this request.

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.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status
    Done
    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions