From 3db2c52e416e171658dbf84465e33417dde77646 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Feb 2026 23:37:19 +0000 Subject: [PATCH 1/3] Initial plan From f8a9618aca27b2625f38465e09a732ff7ec70d10 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Feb 2026 23:44:16 +0000 Subject: [PATCH 2/3] Fix flaky test HttpRequestBuffering_DoesNotBufferDisabledOrOversizedLogs by suppressing ASP.NET Core infrastructure logs Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> --- .../Logging/AcceptanceTests.cs | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs index d94800adbc5..33463244f86 100644 --- a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs +++ b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs @@ -900,14 +900,10 @@ await RunAsync( services => services .AddLogging(builder => { - // enable Microsoft.AspNetCore.Routing.Matching.DfaMatcher debug logs - // which are produced by ASP.NET Core within HTTP context. - // This is what is going to be buffered and tested. - builder.AddFilter("Microsoft.AspNetCore.Routing.Matching.DfaMatcher", LogLevel.Debug); - - // Disable logs from HTTP logging middleware, otherwise even though they are not buffered, - // they will be logged as usual and contaminate test results: - builder.AddFilter("Microsoft.AspNetCore.HttpLogging", LogLevel.None); + // Disable logs from all ASP.NET Core infrastructure, otherwise they + // will contaminate test results: + builder.AddFilter("Microsoft.AspNetCore", LogLevel.None); + builder.AddFilter("Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware", LogLevel.None); builder.AddPerIncomingRequestBuffer(options => { @@ -944,10 +940,10 @@ await RunAsync( logger.LogTrace($"This is a huge log message 3, {hugeState}"); await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout); - // 1st log record is from DfaMatcher, - // 2, 3, 4th are from our "test" category - // and 5 and 6th are logs from the /logatrequest endpoint - Assert.Equal(6, logCollector.Count); + // 1st is the flushed Trace from "test" category + // 2, 3rd are unbuffered logs from our "test" category + // and 4 and 5th are logs from the /logatrequest endpoint + Assert.Equal(5, logCollector.Count); Assert.Equal(LogLevel.Trace, logCollector.LatestRecord.Level); Assert.Equal("test", logCollector.LatestRecord.Category); }); From 010b0ad86e33354ce3a97f13c29e651c3742a4b6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Feb 2026 20:56:19 +0000 Subject: [PATCH 3/3] Fix comment to correctly describe log emission order Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> --- .../Logging/AcceptanceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs index 33463244f86..6f47645d001 100644 --- a/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs +++ b/test/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware.Tests/Logging/AcceptanceTests.cs @@ -941,8 +941,8 @@ await RunAsync( await WaitForLogRecordsAsync(logCollector, _defaultLogTimeout); // 1st is the flushed Trace from "test" category - // 2, 3rd are unbuffered logs from our "test" category - // and 4 and 5th are logs from the /logatrequest endpoint + // 2nd and 3rd are logs emitted by the /logatrequest endpoint + // and 4th and 5th are unbuffered logs from our "test" category Assert.Equal(5, logCollector.Count); Assert.Equal(LogLevel.Trace, logCollector.LatestRecord.Level); Assert.Equal("test", logCollector.LatestRecord.Category);