-
Notifications
You must be signed in to change notification settings - Fork 287
Fix SignOutSessionStateManager compilation error for .NET 11+ #5086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Update LoginDisplay.razor in both blazorpizza and blazorpizzaaot scenarios to use conditional compilation. For .NET 11+, use the new Navigation.NavigateToLogout() method. For .NET 8-10, continue using the deprecated SignOutSessionStateManager for backward compatibility. Co-authored-by: LoopedBard3 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes compilation errors in the Blazor Pizza application when targeting .NET 11+ by adding conditional compilation support for the removed SignOutSessionStateManager API. The changes enable the app to build successfully across multiple .NET versions (net8-net10 using the legacy API, net11+ using the new NavigateToLogout() method).
Changes:
- Introduced code-behind files (
LoginDisplay.razor.cs) for both blazorpizza and blazorpizzaaot scenarios - Added conditional compilation directives to support both legacy and new authentication APIs
- Migrated code from inline
@codeblocks to separate code-behind files
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/scenarios/blazorpizza/src/BlazingPizza.Client/Shared/LoginDisplay.razor | Removed inline @Inject directives and @code block, delegating to code-behind |
| src/scenarios/blazorpizza/src/BlazingPizza.Client/Shared/LoginDisplay.razor.cs | New code-behind file with conditional compilation for .NET 11+ compatibility |
| src/scenarios/blazorpizzaaot/src/BlazingPizza.Client/Shared/LoginDisplay.razor | Removed inline @Inject directives and @code block, delegating to code-behind |
| src/scenarios/blazorpizzaaot/src/BlazingPizza.Client/Shared/LoginDisplay.razor.cs | New code-behind file with conditional compilation for .NET 11+ compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,28 @@ | |||
| using Microsoft.AspNetCore.Components; | |||
| using Microsoft.AspNetCore.Components.WebAssembly.Authentication; | |||
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing using directive for System.Threading.Tasks. The Task type used in the async BeginSignOut method (line 22) requires an explicit using directive. Other files in this project (e.g., OrdersClient.cs, Program.cs) explicitly include this using statement, and it should be added here for consistency and to ensure compilation succeeds across all target frameworks, especially when implicit usings may not be enabled.
| using Microsoft.AspNetCore.Components.WebAssembly.Authentication; | |
| using Microsoft.AspNetCore.Components.WebAssembly.Authentication; | |
| using System.Threading.Tasks; |
| @@ -0,0 +1,28 @@ | |||
| using Microsoft.AspNetCore.Components; | |||
| using Microsoft.AspNetCore.Components.WebAssembly.Authentication; | |||
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing using directive for System.Threading.Tasks. The Task type used in the async BeginSignOut method (line 22) requires an explicit using directive. Other files in this project (e.g., OrdersClient.cs, Program.cs) explicitly include this using statement, and it should be added here for consistency and to ensure compilation succeeds across all target frameworks, especially when implicit usings may not be enabled.
| using Microsoft.AspNetCore.Components.WebAssembly.Authentication; | |
| using Microsoft.AspNetCore.Components.WebAssembly.Authentication; | |
| using System.Threading.Tasks; |
DrewScoggins
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
DrewScoggins
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
SignOutSessionStateManagerwas removed in .NET 11, breaking Blazor Pizza app builds. This PR adds conditional compilation to support both the legacy API (net8-net10) and the newNavigateToLogout()method (net11+).Changes
Updated LoginDisplay.razor (both
blazorpizzaandblazorpizzaaotscenarios):SignOutSessionStateManageronly for net8-net10NavigateToLogout()extension method for net11+Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
6s7vsblobprodcus313.vsblob.vsassets.io/usr/bin/dotnet dotnet build BlazingPizza.sln -f net8.0(dns block)bcnvsblobprodcus378.vsblob.vsassets.io/usr/bin/dotnet dotnet build BlazingPizza.sln -f net8.0(dns block)kh4vsblobprodcus325.vsblob.vsassets.io/usr/bin/dotnet dotnet build BlazingPizza.sln -f net8.0(dns block)mfjvsblobprodcus373.vsblob.vsassets.io/usr/bin/dotnet dotnet build BlazingPizza.sln -f net8.0(dns block)p2ovsblobprodcus312.vsblob.vsassets.io/usr/bin/dotnet dotnet build BlazingPizza.sln -f net8.0(dns block)s4uvsblobprodcus326.vsblob.vsassets.io/usr/bin/dotnet dotnet build BlazingPizza.sln -f net8.0(dns block)ukkvsblobprodcus352.vsblob.vsassets.io/usr/bin/dotnet dotnet build BlazingPizza.sln -f net8.0(dns block)vwvvsblobprodcus334.vsblob.vsassets.io/usr/bin/dotnet dotnet build BlazingPizza.sln -f net8.0(dns block)x3yvsblobprodcus370.vsblob.vsassets.io/usr/bin/dotnet dotnet build BlazingPizza.sln -f net8.0(dns block)ytvvsblobprodcus310.vsblob.vsassets.io/usr/bin/dotnet dotnet build BlazingPizza.sln -f net8.0(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
When trying to build the Blazing Pizza app in src/scenarios/blazorpizza/src we are hitting the following error:
e\app\BlazingPizza.Client\Shared\LoginDisplay.razor(2,9): error CS0246: The type or namespace name 'SignOutSessionStateManager' could not be found (are you missing a using directive or an assembly reference?) [\e\app\BlazingPizza.Client\BlazingPizza.Client.csproj::TargetFramework=net11.0]with a fuller log being as follows: