sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Out of order bug in AspNet

Open SimonCropp opened this issue 3 years ago • 1 comments

the behavior of AddAspNet is different based on if options.DiagnosticLogger or options.ScopeStackContainer has been set before or after

public static void AddAspNet(this SentryOptions options, RequestSize maxRequestBodySize = RequestSize.None)
    {
        var payloadExtractor = new RequestBodyExtractionDispatcher(
            new IRequestPayloadExtractor[] { new FormRequestPayloadExtractor(), new DefaultRequestPayloadExtractor() },
            options,
            () => maxRequestBodySize);

        var eventProcessor = new SystemWebRequestEventProcessor(payloadExtractor, options);

        // Ignore options.IsGlobalModeEnable, we always want to use HttpContext as backing store here
        options.ScopeStackContainer ??= new HttpContextScopeStackContainer();

        options.DiagnosticLogger ??= new TraceDiagnosticLogger(options.DiagnosticLevel);
        options.Release ??= SystemWebVersionLocator.Resolve(options, HttpContext.Current);
        options.AddEventProcessor(eventProcessor);
        options.AddDiagnosticSourceIntegration();
    }

SimonCropp avatar Jan 25 '22 08:01 SimonCropp

So at least docs don't lead you the wrong way: https://github.com/getsentry/sentry-docs/pull/4650

bruno-garcia avatar Jan 27 '22 22:01 bruno-garcia