Blazor server does prerendering to load the application initially, as noted in _Host.cshml:
<app>
<component type="typeof(App)" render-mode="ServerPrerendered" />
</app>
This causes the NavigationManager to be null because the Blazor component is not yet started, as it is in "pre-rendering mode". Once the app is active, it renders again. On the pre-render, the MicrosoftIdentityCircuitHandler is not started.
Use the _httpContext in the case of the pre-render, as it is available at that time.
Customers can also choose to not pre-render, if they want.
<app>
<component type="typeof(App)" render-mode="Server" />
</app>
This has been fixed in master, but there are API breaking changes there, we do not have our documentation updated yet, but there is a migration aid, it might be a bit premature, but you are welcome to try this out, and/or the workaround of removing the prerendering (see above).
@DanielMannInCycle @schmid37 @gwgrubbs @jaimunday @josheinstein
Hey @jennyf19 the workaround works fine. I hope I'll find some time to test the master. Got some internal development I need to deliver in the next days.
Thanks for the quick feedback @schmid37 If there is anything we can do to help with the testing let us know.
Included in 0.3.0-preview release.
Most helpful comment
This has been fixed in master, but there are API breaking changes there, we do not have our documentation updated yet, but there is a migration aid, it might be a bit premature, but you are welcome to try this out, and/or the workaround of removing the prerendering (see above).
@DanielMannInCycle @schmid37 @gwgrubbs @jaimunday @josheinstein