-
Notifications
You must be signed in to change notification settings - Fork 6k
Add ASP.NET Core 3.0 breaking changes #15044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
4ce71d2
93c4269
5b1807f
0690340
3cba058
0ddd1a8
6b9af12
7bbac57
cee339b
01e1329
cc14910
5ae667f
87fce7a
34304a7
65ebad3
62e50bc
5b87d62
cc2d802
13922a1
55904a4
ab15fac
40302f1
ffba661
469c978
b818c0f
d33f487
87ffdd6
62b673d
5b39fad
d8377e7
621ccca
b52cf90
42253b6
2c84018
52934a1
609bf64
28f42b9
40ced30
0418d6d
e2ccdd5
bc9f1cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
### Async suffix trimmed from controller action names | ||
|
||
As part of addressing [aspnet/AspNetCore#4849](https://github.com/aspnet/AspNetCore/issues/4849), ASP.NET Core MVC trims the suffix `Async` from action names by default. This change affects both routing and link generation. | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### Version introduced | ||
|
||
3.0 | ||
|
||
#### Old behavior | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Consider the following ASP.NET Core MVC controller: | ||
|
||
```csharp | ||
public class ProductController : Controller | ||
{ | ||
public async IActionResult ListAsync() | ||
{ | ||
var model = await DbContext.Products.ToListAsync(); | ||
return View(model); | ||
} | ||
} | ||
``` | ||
|
||
Prior to ASP.NET Core 3.0, the action is routable via `Product/ListAsync`. Link generation requires specifying the `Async` suffix. For example: | ||
|
||
```cshtml | ||
<a asp-controller="Product" asp-action="ListAsync">List</a> | ||
``` | ||
|
||
#### New behavior | ||
|
||
In ASP.NET Core 3.0, the action is routable via `Product/List`. Link generation requires not specifying the `Async` suffix. For example: | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```cshtml | ||
<a asp-controller="Product" asp-action="List">List</a> | ||
``` | ||
|
||
This change doesn't affect names specified using the `[ActionName]` attribute. The new behavior can be disabled by setting `MvcOptions.SuppressAsyncSuffixInActionNames` to `false` in `Startup.ConfigureServices`: | ||
|
||
```csharp | ||
services.AddMvc(options => | ||
{ | ||
options.SuppressAsyncSuffixInActionNames = false; | ||
}); | ||
``` | ||
|
||
#### Reason for change | ||
|
||
By convention, asynchronous .NET methods are suffixed with `Async`. However, when a method defines an MVC action, it's undesirable to use the `Async` suffix. | ||
|
||
#### Recommended action | ||
|
||
If your app depends on MVC actions retaining the `Async` suffix in the name, choose one of the following mitigations: | ||
|
||
- Use the `[ActionName]` attribute to preserve the original name. | ||
- Disable the renaming entirely by setting `MvcOptions.SuppressAsyncSuffixInActionNames` to `false` in `Startup.ConfigureServices`: | ||
|
||
```csharp | ||
services.AddMvc(options => | ||
{ | ||
options.SuppressAsyncSuffixInActionNames = false; | ||
}); | ||
``` | ||
|
||
#### Category | ||
|
||
ASP.NET Core | ||
|
||
#### Affected APIs | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Not detectable via API analysis |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
### AddAuthorization overload lives in a different assembly | ||
|
||
We renamed the core `AddAuthorization` methods that used to live in `Microsoft.AspNetCore.Authorization` to be `AddAuthorizationCore`. The old `AddAuthorization` methods still exist, but are in the `Microsoft.AspNetCore.Authorization.Policy` package instead. Apps that are using both should see no impact. Apps that weren't using the policy package need to switch to using `AddAuthorizationCore`. | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### Version introduced | ||
|
||
3.0 | ||
|
||
#### Old behavior | ||
|
||
`AddAuthorization` methods existed in `Microsoft.AspNetCore.Authorization`. | ||
|
||
#### New behavior | ||
|
||
`AddAuthorization` methods exist in `Microsoft.AspNetCore.Authorization.Policy`. `AddAuthorizationCore` is the new name for the old methods. | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### Reason for change | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
We wanted the better `AddAuthorization` name to add all of the common services needed for authorization. We decided to take over the old name in 3.0. | ||
|
||
#### Recommended action | ||
|
||
Either add a reference to `Microsoft.AspNetCore.Authorization.Policy` or use `AddAuthorizationCore` instead. | ||
|
||
#### Category | ||
|
||
ASP.NET Core | ||
|
||
#### Affected APIs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There has to be a commented-out section with Affected APIs as a level-3 head. The individual APIs should be in a bulleted list, and they should be formatted as fenced docIDs (e.g., `T:System.String`. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the heads up. Out of curiosity, what's the purpose of the commented-out section? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will be used by diagnostic tools (the compatibility analyzers) to diagnose potential compatibility issues. |
||
|
||
[AddAuthorization(Action<AuthorizationOptions>)](/dotnet/api/microsoft.extensions.dependencyinjection.authorizationservicecollectionextensions.addauthorization?view=aspnetcore-2.2#Microsoft_Extensions_DependencyInjection_AuthorizationServiceCollectionExtensions_AddAuthorization_Microsoft_Extensions_DependencyInjection_IServiceCollection_System_Action_Microsoft_AspNetCore_Authorization_AuthorizationOptions__) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
### Removed Microsoft.AspNetCore.All shared framework | ||
|
||
Earlier this year, we announced the `Microsoft.AspNetCore.App` metapackage (see https://github.com/aspnet/Announcements/issues/287). That announcement said: | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
> The existing `Microsoft.AspNetCore.All` meta-package will continue to be made available throughout the 2.x lifecycle, but **we recommend customers move to the new Microsoft.AspNetCore.App meta-package** and then add individual references to any of the removed packages if their app requires it. | ||
|
||
For migration instructions, see [Migrating from Microsoft.AspNetCore.All to Microsoft.AspNetCore.App](/aspnet/core/fundamentals/metapackage?view=aspnetcore-2.1#migrating-from-microsoftaspnetcoreall-to-microsoftaspnetcoreapp). | ||
|
||
As of ASP.NET Core 3.0, the `Microsoft.AspNetCore.All` metapackage and the matching `Microsoft.AspNetCore.All` shared framework is no longer produced. | ||
|
||
This package will be available in ASP.NET Core 2.2 and will continue to receive servicing updates in ASP.NET Core 2.1. | ||
|
||
#### Version introduced | ||
|
||
3.0 | ||
|
||
#### Old behavior | ||
|
||
Apps were able to use the `Microsoft.AspNetCore.All` metapackage to target the `Microsoft.AspNetCore.All` shared framework on .NET Core. | ||
|
||
#### New behavior | ||
|
||
There is no `Microsoft.AspNetCore.All` shared framework as part of .NET Core 3.0. | ||
|
||
#### Reason for change | ||
|
||
As [previously announced](https://github.com/aspnet/Announcements/issues/287), the `Microsoft.AspNetCore.All` metapackage included a large number of external dependencies. | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### Recommended action | ||
|
||
Migrate your app to use the `Microsoft.AspNetCore.App` framework. Components that were previously available in `Microsoft.AspNetCore.All` are **still available on NuGet**. Those components are now deployed with your app instead of being included in the shared framework. | ||
|
||
#### Category | ||
|
||
ASP.NET Core | ||
|
||
#### Affected APIs | ||
|
||
Any API that was only present in the `Microsoft.AspNetCore.All` framework. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
### AspNetCoreModule V1 removed from Windows Hosting Bundle | ||
|
||
The Windows Hosting Bundle won't contain AspNetCoreModule (ANCM) V1 in the ASP.NET Core 3.0 release. | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ANCM V2 is backwards compatible with ANCM OutOfProcess and is recommended for use with ASP.NET Core 3.0 apps. | ||
|
||
For discussion, see https://github.com/aspnet/AspNetCore/issues/7095. | ||
|
||
#### Version introduced | ||
|
||
3.0 | ||
|
||
#### Old behavior | ||
scottaddie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ANCM V1 is included in the Windows Hosting Bundle. | ||
|
||
#### New behavior | ||
|
||
ANCM V1 isn't included in the Windows Hosting Bundle. | ||
|
||
#### Reason for change | ||
|
||
ANCM V2 is backwards compatible with ANCM OutOfProcess and is recommended for use with ASP.NET Core 3.0 apps. | ||
|
||
#### Recommended action | ||
|
||
Use ANCM V2 with ASP.NET Core 3.0 apps. | ||
|
||
If ANCM V1 is required, it can be installed using the ASP.NET Core 2.1 or 2.2 Windows Hosting Bundle. | ||
|
||
This change will break ASP.NET Core 3.0 apps that: | ||
|
||
- Explicitly opted into using ANCM V1 with `<AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>`. | ||
- Have a custom *web.config* file with `<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />`. | ||
|
||
#### Category | ||
|
||
ASP.NET Core | ||
|
||
#### Affected APIs | ||
|
||
Not detectable via API analysis |
Uh oh!
There was an error while loading. Please reload this page.