-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Describe the bug
I created an new ASP.NET Core Web API (.net 6.0) application and the only changes i made was trying to add google authentication.
using Microsoft.AspNetCore.Authentication.Google;
var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration;
builder.Services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = GoogleDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = GoogleDefaults.AuthenticationScheme;
})
.AddGoogle(GoogleDefaults.AuthenticationScheme, options =>
{
options.ClientId = config.GetSection("GoogleData:ClientId").Value;
options.ClientSecret = config.GetSection("GoogleData:ClientSecret").Value;
});
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(); var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseCookiePolicy();
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();I added the [Authorize] attribute to the default GetWeatherForecast api endpoint and when i try to call the enpoint from Swagger or Postman the application crashes.
Exception thrown at 0x00007FFE2CAD1E2B (coreclr.dll) in [App_name].exe: 0xC0000005: Access violation writing location 0x000000BE97B00FF8.
The Common Language Runtime cannot stop at this exception. Common causes include: incorrect COM interop marshalling and memory corruption. To investigate further use native-only debugging.
Unhandled exception at 0x00007FFE2CAD1E2B (coreclr.dll) in [App_name].exe: 0xC0000005: Access violation writing location 0x000000BE97B00FF8.
The Common Language Runtime cannot stop at this exception. Common causes include: incorrect COM interop marshalling and memory corruption. To investigate further use native-only debugging.
the debug output ends with
The program '[11428] [App_name].exe' has exited with code 3221225477 (0xc0000005) 'Access violation'.
Environment
Visual Studio Community 2022 (64-bit) - Version 17.2.6
Windows 11