2

I am working on a Blazor client app with an azure functions API. I have the Azure Static Web Apps CLI, and Azure function core tools, set up and working.

The problem is, when using the built-in social authentication, it is crashing instantly when the debug login page is displayed. I have no idea how to debug this, I have put breakpoints everywhere, but everything ends and there is no way to get an error, in the console I get

For detailed output, run func with --verbose flag.
[2023-03-15T11:42:41.659Z] Host lock lease acquired by instance ID '0000000000000000000000003FF48B6B'.

C:\Users\xxx\AppData\Local\AzureFunctionsTools\Releases\4.32.0\cli_x64\func.exe (process 16408) exited with code -1.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .

I get the same error message when I go to every one of the following login pages.

  • http://localhost:4280/.auth/login/aad
  • http://localhost:4280/.auth/login/github
  • http://localhost:4280/.auth/login/twitter
  • http://localhost:4280/.auth/login/google

I was wondering if it was caching a log-in and something was getting confused, but I went to

http://localhost:4280/.auth/me

and got the following result

{"clientPrincipal":null}

If I go http://localhost:4280/.auth/login/aad (or the other authentication URLs) in a browser that was not started by visual studio when debugging. It works okay and when I login I get the following result when I go to http://localhost:4280/.auth/me

{"clientPrincipal":{"userId":"GUID-HERE","userRoles":["admin"],"claims":[],"identityProvider":"twitter","userDetails":"asdf"}}

I would just use a browser that not started by visual studio, but then I don’t get break points.

Ashley Kilgour
  • 1,110
  • 2
  • 15
  • 33
  • I encountered this error with a Blazor WASM app on a .NET Core hosted application this morning that was working properly last evening. I wonder if there's an issue with AAD. – Vinnie Fusca Mar 15 '23 at 15:17

1 Answers1

1

Not sure if this is the same issue, but apparently a recent update is causing issues with breakpoints in the debugger and authentication patterns.

Related Stack Overflow Topic

Apparently the temporary workaround is to disable all breakpoints (Ctrl+Shift+F9), but that sort of defeats the purpose of using the debugger.

Vinnie Fusca
  • 684
  • 1
  • 6
  • 11
  • So I seen this and didnt think it would work. But you listed the keyboard short cut which I am always a fan of. It worked like a charm, although you only need to disable the breakpoints, and I can then turn them back on. – Ashley Kilgour Mar 15 '23 at 23:41