Skip to content

Commit

Permalink
Document database error page breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
scottaddie committed Aug 21, 2020
1 parent b6601da commit d5cae12
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 2 deletions.
7 changes: 6 additions & 1 deletion docs/core/compatibility/3.1-5.0.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Breaking changes, version 3.1 to 5.0
description: Lists the breaking changes from version 3.1 to version 5.0 of .NET, ASP.NET Core, and EF Core.
ms.date: 07/27/2020
ms.date: 08/20/2020
---
# Breaking changes for migration from version 3.1 to 5.0

Expand All @@ -25,6 +25,7 @@ If you're migrating from version 3.1 of .NET Core, ASP.NET Core, or EF Core to v
- [Localization: "Pubternal" APIs removed](#localization-pubternal-apis-removed)
- [Localization: Obsolete constructor removed in request localization middleware](#localization-obsolete-constructor-removed-in-request-localization-middleware)
- [Localization: ResourceManagerWithCultureStringLocalizer class and WithCulture interface member removed](#localization-resourcemanagerwithculturestringlocalizer-class-and-withculture-interface-member-removed)
- [Middleware: Database error page marked as obsolete](#middleware-database-error-page-marked-as-obsolete)
- [Security: Cookie name encoding removed](#security-cookie-name-encoding-removed)
- [Security: IdentityModel NuGet package versions updated](#security-identitymodel-nuget-package-versions-updated)
- [SignalR: MessagePack Hub Protocol moved to MessagePack 2.x package](#signalr-messagepack-hub-protocol-moved-to-messagepack-2x-package)
Expand Down Expand Up @@ -96,6 +97,10 @@ If you're migrating from version 3.1 of .NET Core, ASP.NET Core, or EF Core to v

***

[!INCLUDE[Middleware: Database error page marked as obsolete](~/includes/core-changes/aspnetcore/5.0/middleware-database-error-page-obsolete.md)]

***

[!INCLUDE[Security: Cookie name encoding removed](~/includes/core-changes/aspnetcore/5.0/security-cookie-name-encoding-removed.md)]

***
Expand Down
7 changes: 6 additions & 1 deletion docs/core/compatibility/aspnetcore.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: ASP.NET Core breaking changes
titleSuffix: ""
description: Lists the breaking changes in ASP.NET Core.
ms.date: 07/17/2020
ms.date: 08/20/2020
author: scottaddie
ms.author: scaddie
---
Expand Down Expand Up @@ -63,6 +63,7 @@ The following breaking changes are documented on this page:
- [Localization: Obsolete constructor removed in request localization middleware](#localization-obsolete-constructor-removed-in-request-localization-middleware)
- [Localization: ResourceManagerWithCultureStringLocalizer class and WithCulture interface member removed](#localization-resourcemanagerwithculturestringlocalizer-class-and-withculture-interface-member-removed)
- [Logging: DebugLogger class made internal](#logging-debuglogger-class-made-internal)
- [Middleware: Database error page marked as obsolete](#middleware-database-error-page-marked-as-obsolete)
- [MVC: Controller action Async suffix removed](#mvc-async-suffix-trimmed-from-controller-action-names)
- [MVC: JsonResult moved to Microsoft.AspNetCore.Mvc.Core](#mvc-jsonresult-moved-to-microsoftaspnetcoremvccore)
- [MVC: Precompilation tool deprecated](#mvc-precompilation-tool-deprecated)
Expand Down Expand Up @@ -156,6 +157,10 @@ The following breaking changes are documented on this page:

***

[!INCLUDE[Middleware: Database error page marked as obsolete](~/includes/core-changes/aspnetcore/5.0/middleware-database-error-page-obsolete.md)]

***

[!INCLUDE[Security: Cookie name encoding removed](~/includes/core-changes/aspnetcore/5.0/security-cookie-name-encoding-removed.md)]

***
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
### Middleware: Database error page marked as obsolete

The [DatabaseErrorPageMiddleware](/dotnet/api/microsoft.aspnetcore.diagnostics.entityframeworkcore.databaseerrorpagemiddleware?view=aspnetcore-3.0) and its associated extension methods were marked as obsolete in .NET 5.0. The middleware and extension methods will be removed in .NET 6.0. The functionality will instead be provided by `DatabaseDeveloperPageExceptionFilter` and its extension methods.

For discussion, see the GitHub issue at [dotnet/aspnetcore#24987](https://github.com/dotnet/aspnetcore/issues/24987).

#### Version introduced

5.0 RC 1

#### Old behavior

`DatabaseErrorPageMiddleware` and its associated extension methods weren't obsolete.

#### New behavior

`DatabaseErrorPageMiddleware` and its associated extension methods are obsolete.

#### Reason for change

`DatabaseErrorPageMiddleware` was migrated to an extensible API for the [developer exception page](/aspnet/core/fundamentals/error-handling#developer-exception-page). For more information on the extensible API, see GitHub issue [dotnet/aspnetcore#8536](https://github.com/dotnet/aspnetcore/issues/8536).

#### Recommended action

Complete the following steps:

1. Stop using `DatabaseErrorPageMiddleware` in your project. For example, remove the `UseDatabaseErrorPage` method call from `Startup.Configure`:

```csharp
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDatabaseErrorPage();
}
}
```

1. Ensure the developer exception page is added to your project. For example, call the <xref:Microsoft.AspNetCore.Builder.DeveloperExceptionPageExtensions.UseDeveloperExceptionPage%2A> method in `Startup.Configure`:

```csharp
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
}
```

1. Add the database developer page exception filter to the services collection. For example, call the `AddDatabaseDeveloperPageExceptionFilter` method in `Startup.ConfigureServices`:

```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddDatabaseDeveloperPageExceptionFilter();
}
```

#### Category

ASP.NET Core

#### Affected APIs

- [Microsoft.AspNetCore.Builder.DatabaseErrorPageExtensions.UseDatabaseErrorPage](/dotnet/api/microsoft.aspnetcore.builder.databaseerrorpageextensions.usedatabaseerrorpage?view=aspnetcore-3.0)
- [Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware](/dotnet/api/microsoft.aspnetcore.diagnostics.entityframeworkcore.databaseerrorpagemiddleware?view=aspnetcore-3.0)

<!--

#### Affected APIs

- `Overload:Microsoft.AspNetCore.Builder.DatabaseErrorPageExtensions.UseDatabaseErrorPage`
- `T:Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware`

-->

0 comments on commit d5cae12

Please sign in to comment.