Skip to content

Warning about UseAuthorisation appearing in 3.1 #15203

@centreboard

Description

@centreboard

Describe the bug

Warning about .UseAuthorisation() when chaining builder pattern calls in 3.1 preview 1 instead of calling on separate lines.
This appears to be the message from #14401

To Reproduce

Steps to reproduce the behaviour:

  1. Using this version of ASP.NET Core '3.1.100-preview1-014459'
  2. Run this code
  • 'dotnet new webapp'
  • change
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
    endpoints.MapRazorPages();
});
  • to
app.UseRouting()
   .UseAuthorization()
   .UseEndpoints(endpoints =>
   {
       endpoints.MapRazorPages();
   });
  1. Run dotnet build
  2. See Startup.cs(46,13): warning ASP0001: The call to UseAuthorization should appear between app.UseRouting() and app.UseEndpoints(..) for authorization to be correctly evaluated.

Expected behaviour

No warnings

Additional context

Add any other context about the problem here.
Include the output of dotnet --info

.NET Core SDK (reflecting any global.json):
Version: 3.1.100-preview1-014459
Commit: ac3b59712d

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.100-preview1-014459\

Host (useful for support):
Version: 3.1.0-preview1.19506.1
Commit: bbf5542781

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions