Skip to content

Blazor Identity with Global RenderMode #51476

@IamRewt

Description

@IamRewt

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Making a new Blazor WebApp in RC2, if you select individual accounts and Global Interactive server mode:

  1. The template does not automatically add @rendermode="RenderMode.InteractiveServer" to the App.razor Routes and Head Outlet components. This only occurs when using the new identity pages, when they are excluded, the rendermode is automatically added.

  2. When you manually add the global rendermode in, the identity pages begin giving Null Reference Exceptions in several locations. For example: visiting the Register Page throws a null reference exception in StatusMessage.razor @ line 28: private string? MessageFromCookie => HttpContext.Request.Cookies[IdentityRedirectManager.StatusCookieName];

Removing the global rendermode from the Routes component stops the exceptions, but then eliminates the needed functionality.

Expected Behavior

The expected behavior was to be able to use the Interactive Server Render Mode globally with the new razor identity pages.

Steps To Reproduce

  1. Create a new blazor web app in RC2.
  2. Select 'Individual Accounts' for Authentication Type.
  3. Select 'Server' for Interactivity Type.
  4. Select 'Global' for Interactivity Location.
  5. Add @rendermode="RenderMode.InteractiveServer" to the HeadOutlet and Routes components in /Components/App.razor.
  6. Run the application.
  7. Navigate to Register or Login pages.

Exceptions (if any)

System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=BlazorApp1
StackTrace:
at BlazorApp1.Components.Identity.StatusMessage.get_MessageFromCookie() in F:\BlazorApp1\BlazorApp1\Components\Identity\StatusMessage.razor:line 28

.NET Version

.NET8 RC2

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions