DotNetCore Authorization Policy not being picked up in debug mode
<p>I have an auth policy configured in startup.cs </p>

<pre><code>services.AddAuthorization(auth =&gt;
        {
            auth.AddPolicy("Bearer", policy =&gt; policy
                .AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme‌​)
                .RequireAuthenticatedUser().Build());

        });
</code></pre>

<p>and I am using this in an attribute on an api controller:</p>

<p><code>[Authorize("Bearer")]</code></p>

<p>When I run the debugger in VS code, I get an exception :
<code>fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HL14EICAK26S": An unhandled exception was thrown by the application.
System.InvalidOperationException: The AuthorizationPolicy named: 'Bearer' was not found.
   at Microsoft.AspNetCore.Authorization.AuthorizationPolicy.&lt;CombineAsync&gt;d__9.MoveNext()</code></p>

<p>When I run the program via <code>dotnet  run</code>, I don't get this exception and it's able to pick up on the authorization attribute.</p>

<p>Why is this happening?</p>