From 8288fd12e9ac8efa047aa3ad83ea8cc4ab67e95b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Sep 2025 17:08:35 +0000 Subject: [PATCH 1/4] Initial plan From 23d67d8ea0121bbccc54183d694d1b223ec0dc50 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Sep 2025 17:17:38 +0000 Subject: [PATCH 2/4] Add HTTP logging middleware breaking change documentation for .NET 8 Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- .../httpLogging-addhttplogging-requirement.md | 59 +++++++++++++++++++ docs/core/compatibility/toc.yml | 2 + 2 files changed, 61 insertions(+) create mode 100644 docs/core/compatibility/aspnet-core/8.0/httpLogging-addhttplogging-requirement.md diff --git a/docs/core/compatibility/aspnet-core/8.0/httpLogging-addhttplogging-requirement.md b/docs/core/compatibility/aspnet-core/8.0/httpLogging-addhttplogging-requirement.md new file mode 100644 index 0000000000000..142cf5c220895 --- /dev/null +++ b/docs/core/compatibility/aspnet-core/8.0/httpLogging-addhttplogging-requirement.md @@ -0,0 +1,59 @@ +--- +title: "Breaking change: HTTP logging middleware requires AddHttpLogging" +description: Learn about the breaking change in ASP.NET Core 8.0 where HTTP logging middleware now requires AddHttpLogging to be called on app startup. +ms.date: 11/14/2023 +--- +# HTTP logging middleware requires AddHttpLogging + +ASP.NET Core HTTP logging middleware has been updated with extra functionality. The middleware now requires services registered with . + +## Version introduced + +ASP.NET Core 8.0 + +## Previous behavior + +Previously, HTTP logging could be used by calling only : + +```csharp +var builder = WebApplication.CreateBuilder(args); + +var app = builder.Build(); +app.UseHttpLogging(); +app.MapGet("/", () => "Hello World!"); +app.Run(); +``` + +## New behavior + +If is not called on app startup, ASP.NET Core throws an informative error: + +> System.InvalidOperationException: Unable to resolve service for type 'Microsoft.Extensions.ObjectPool.ObjectPool`1[Microsoft.AspNetCore.HttpLogging.HttpLoggingInterceptorContext]' while attempting to activate 'Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware'. + +## Type of breaking change + +This change is a [behavioral change](../../categories.md#behavioral-change). + +## Reason for change + +Additional features were added to the HttpLogging middleware which are registered (and configurable) via the method. + +## Recommended action + +Ensure that is called at application startup. + +For example: + +```csharp +var builder = WebApplication.CreateBuilder(args); +builder.Services.AddHttpLogging(); + +var app = builder.Build(); +app.UseHttpLogging(); +app.MapGet("/", () => "Hello World!"); +app.Run(); +``` + +## Affected APIs + +- diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 31b1b705cb6bc..32bbaa5b929f3 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -224,6 +224,8 @@ items: href: aspnet-core/8.0/concurrencylimitermiddleware-obsolete.md - name: Custom converters for serialization removed href: aspnet-core/8.0/problemdetails-custom-converters.md + - name: HTTP logging middleware requires AddHttpLogging + href: aspnet-core/8.0/httpLogging-addhttplogging-requirement.md - name: ISystemClock is obsolete href: aspnet-core/8.0/isystemclock-obsolete.md - name: "Minimal APIs: IFormFile parameters require anti-forgery checks" From 5be1a9e89589ecd4cb63d6df793995cbfb2be9f2 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Mon, 29 Sep 2025 17:07:11 -0700 Subject: [PATCH 3/4] human edits --- docs/core/compatibility/8.0.md | 1 + .../httpLogging-addhttplogging-requirement.md | 39 +++++-------------- docs/core/compatibility/toc.yml | 2 +- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/docs/core/compatibility/8.0.md b/docs/core/compatibility/8.0.md index 6c56c864ba3aa..947b451f98097 100644 --- a/docs/core/compatibility/8.0.md +++ b/docs/core/compatibility/8.0.md @@ -18,6 +18,7 @@ If you're migrating an app to .NET 8, the breaking changes listed here might aff | [ConcurrencyLimiterMiddleware is obsolete](aspnet-core/8.0/concurrencylimitermiddleware-obsolete.md) | Source incompatible | | [Custom converters for serialization removed](aspnet-core/8.0/problemdetails-custom-converters.md) | Behavioral change | | [Forwarded Headers Middleware ignores X-Forwarded-* headers from unknown proxies](aspnet-core/8.0/forwarded-headers-unknown-proxies.md) | Behavioral change | +| [HTTP logging middleware requires AddHttpLogging()](aspnet-core/8.0/httpLogging-addhttplogging-requirement.md) | Behavioral change | | [ISystemClock is obsolete](aspnet-core/8.0/isystemclock-obsolete.md) | Source incompatible | | [Minimal APIs: IFormFile parameters require anti-forgery checks](aspnet-core/8.0/antiforgery-checks.md) | Behavioral change | | [Rate-limiting middleware requires AddRateLimiter](aspnet-core/8.0/addratelimiter-requirement.md) | Behavioral change | diff --git a/docs/core/compatibility/aspnet-core/8.0/httpLogging-addhttplogging-requirement.md b/docs/core/compatibility/aspnet-core/8.0/httpLogging-addhttplogging-requirement.md index 142cf5c220895..f268500161eb3 100644 --- a/docs/core/compatibility/aspnet-core/8.0/httpLogging-addhttplogging-requirement.md +++ b/docs/core/compatibility/aspnet-core/8.0/httpLogging-addhttplogging-requirement.md @@ -1,9 +1,9 @@ --- -title: "Breaking change: HTTP logging middleware requires AddHttpLogging" -description: Learn about the breaking change in ASP.NET Core 8.0 where HTTP logging middleware now requires AddHttpLogging to be called on app startup. -ms.date: 11/14/2023 +title: "Breaking change: HTTP logging middleware requires AddHttpLogging()" +description: Learn about the breaking change in ASP.NET Core 8.0 where HTTP logging middleware now requires AddHttpLogging() to be called. +ms.date: 09/29/2025 --- -# HTTP logging middleware requires AddHttpLogging +# HTTP logging middleware requires AddHttpLogging() ASP.NET Core HTTP logging middleware has been updated with extra functionality. The middleware now requires services registered with . @@ -13,20 +13,11 @@ ASP.NET Core 8.0 ## Previous behavior -Previously, HTTP logging could be used by calling only : - -```csharp -var builder = WebApplication.CreateBuilder(args); - -var app = builder.Build(); -app.UseHttpLogging(); -app.MapGet("/", () => "Hello World!"); -app.Run(); -``` +Previously, you could call just `app.UseHttpLogging();` to activate HTTP logging. ## New behavior -If is not called on app startup, ASP.NET Core throws an informative error: +Starting in .NET 8, if you don't also call , an error is raised: > System.InvalidOperationException: Unable to resolve service for type 'Microsoft.Extensions.ObjectPool.ObjectPool`1[Microsoft.AspNetCore.HttpLogging.HttpLoggingInterceptorContext]' while attempting to activate 'Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware'. @@ -36,24 +27,12 @@ This change is a [behavioral change](../../categories.md#behavioral-change). ## Reason for change -Additional features were added to the HttpLogging middleware which are registered (and configurable) via the method. +Additional features were added to the HttpLogging middleware that are registered (and configurable) via the method. ## Recommended action -Ensure that is called at application startup. - -For example: - -```csharp -var builder = WebApplication.CreateBuilder(args); -builder.Services.AddHttpLogging(); - -var app = builder.Build(); -app.UseHttpLogging(); -app.MapGet("/", () => "Hello World!"); -app.Run(); -``` +Call `services.AddHttpLogging()` during host construction. ## Affected APIs -- +None. diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index e4f0d1fa332df..57d0156b74cfb 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -336,7 +336,7 @@ items: href: aspnet-core/8.0/problemdetails-custom-converters.md - name: Forwarded Headers Middleware ignores X-Forwarded-* headers from unknown proxies href: aspnet-core/8.0/forwarded-headers-unknown-proxies.md - - name: HTTP logging middleware requires AddHttpLogging + - name: HTTP logging middleware requires AddHttpLogging() href: aspnet-core/8.0/httpLogging-addhttplogging-requirement.md - name: ISystemClock is obsolete href: aspnet-core/8.0/isystemclock-obsolete.md From 111d7096f2673e83a082261a59c425762449f636 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 30 Sep 2025 12:46:35 -0700 Subject: [PATCH 4/4] try the rename again using git mv --- ...g-requirement.md => httplogging-addhttplogging-requirement.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/core/compatibility/aspnet-core/8.0/{httpLogging-addhttplogging-requirement.md => httplogging-addhttplogging-requirement.md} (100%) diff --git a/docs/core/compatibility/aspnet-core/8.0/httpLogging-addhttplogging-requirement.md b/docs/core/compatibility/aspnet-core/8.0/httplogging-addhttplogging-requirement.md similarity index 100% rename from docs/core/compatibility/aspnet-core/8.0/httpLogging-addhttplogging-requirement.md rename to docs/core/compatibility/aspnet-core/8.0/httplogging-addhttplogging-requirement.md