Open kallievz opened 2 weeks ago
@kallievz I have added a small fix related to this. Can you please pull the latest from main branch and test this if your problem is solved?
Hi @iammukeshm , is this for Blazor Debug, or the unauth exception?
@kallievz it's for the Blazor Debug. I dont seem to have any Auth related issue.
Hi @iammukeshm , running project now launch the browser, it hit the breakpoint once, and errors out with Unauth exception. Brower launches on different port as configured in appsetting.json, and seems to change everytime the project run. Using the one that start up from Aspire does not hit breakpoint. Is there a way to add Cors with only localhost instead of specifying port? If it was just localhost, it would work, but now the port is set dynamically everytime project run,
@kallievz so the blazor app is set to run on 7100 port. If this port is already in use, it would re-assign to a random port, which i think is happening in your case. Do check if the port is in use.
Else, as a work around, you can disable CORS.
Open up namespace FSH.Framework.Infrastructure.Cors.Extensions and edit the following, just add .AllowAnyOrigin()
internal static IServiceCollection AddCorsPolicy(this IServiceCollection services, IConfiguration config)
{
var corsOptions = config.GetSection(nameof(CorsOptions)).Get<CorsOptions>();
if (corsOptions == null) { return services; }
return services.AddCors(opt =>
opt.AddPolicy(CorsPolicy, policy =>
policy.AllowAnyHeader()
.AllowAnyMethod()
.AllowAnyOrigin()));
}
It could be a workaround, but would prefer to use Cors policy. A bit paranoid about unauthed access. I dont want to open that door, but for a dev environment i could prob do it.
It is being used already by Aspire Blazor app. So it seems it is spinning up the Blazor app twice, and linking debugger to the new one not configured on port 7100, almost like 2 Blazor instances running, and one being linked.
Not sure if it is project related, or my ide, but seems when launching via aspire the breakpoints in Blazor is not being hit due to symbols not being loaded. FSH.Blazor not even showing up in debug/modules in order to set loading of symbols.
I can hit the Blazor Breakpoints in V1.
There is a unauthoirised exception i am trying to pinpoint everytime i log into V2 after login button event, but cant trap it due to debug not working. I can somehow figure out that it might be the profile-picture, as it is not rendering.
Seems to be related to SO post https://stackoverflow.com/questions/76890354/why-visual-studio-2022-dont-go-to-breakpoint-razor-file-in-blazor-wasm-or-ho