Skip to content
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

Blazor Web App Template Global Interactivity location causes Not Found issue when navigate to the page/component in Server project. #58944

Closed
1 task done
DillionVVV opened this issue Nov 14, 2024 · 4 comments
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity

Comments

@DillionVVV
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Firstly, I understand the basics of Blazor render mode. When we use "Blazor Web App" template create application, it will generate two projects: main project (server) and .Client project (client), then we need to put the server-side rendering component in the server project and put the client-side rendering component in the .client project.

Recently, I found that when use "Blazor Web App" template create application, in the Additional Information window,

Image

If we select the select the "Auto (Server and WebAssembly)" Interactive render mode and "Global" Interactivity location, then in the Blazor Server project add a Test component (set the rendermode as InteractiveServer), after running the application and navigate to the Test page, firstly it will show the Test page content, after some seconds (2 or 3 seconds), it will auto display "Not Found" in the page.

I have also report this issue in this thread: #58480

But this issue still not fixed in .NET 9.

Expected Behavior

After redirecting to test page, it should stay on the test page instead of showing "Not Found".

Steps To Reproduce

  1. Create a new Blazor application using the Blazor Web App Template.
    In the Additional Information window, select the "Auto (Server and WebAssembly)" Interactive render mode and "Global" Interactivity location:
    Image

  2. In the Server project, add a Testpage component in the Components/Pages folder, like this:

    Image

  3. Running the application, navigate to the Test page, firstly the output as below:

    Image

    then, a few seconds later, it will auto display "Not Found", like this:

    Image

Exceptions (if any)

No response

.NET Version

.NET 8 and .NET 9

Anything else?

I check it using the following version of VS 2022, both of them show the same issue:

Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.11.5

Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.12.0

Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.12.0 Preview 3.0

Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.13.0 Preview 1.0

Besides, I also compare it with my old Blazor Web Application, it seems that this issue relate the Routes.razor component and the Layout content, in previous projects, these files are in the Server project, but now they are in the Client project.

Image

And when use "Blazor Web App" template create application, in the Additional Information window, if we select the "Per page/Component" Interactivity location, these files are also in the server project.

So this might be a bug about the "Blazor Web App" template and Interactivity location. Please help to check and fix it.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Nov 14, 2024
@javiercn
Copy link
Member

@DillionVVV thanks for contacting us.

This behavior is by design. On global interactivity, all the pages should be on the client project. Otherwise, they won't be in any assembly downloaded to the browser, not registered on the client router and that will result in the not found that you are seeing.

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Nov 15, 2024
Copy link
Contributor

Hi @DillionVVV. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@guardrex
Copy link
Contributor

guardrex commented Nov 18, 2024

BTW @danroth27 ... This is what I was covering that you requested I pull on dotnet/AspNetCore.Docs#34041. If this is a supported scenario, then I recommend we bring that coverage back, as it's hard to guess.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity
Projects
None yet
Development

No branches or pull requests

3 participants