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 Server - Cannot find the fallback endpoint specified by route values: { page: /_Host, area: } exception with RC1 #36535

Closed
Webreaper opened this issue Sep 15, 2021 · 10 comments
Labels
area-blazor Includes: Blazor, Razor Components feature-source-generators ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved

Comments

@Webreaper
Copy link

Describe the bug

I have a Blazor Server app (here) which has been running fine with all of the .Net 6 previews. It's currently deployed on Preview-7 and working without issue.

Last night I upgraded to .Net 6 RC1, and am now see this exception at startup:

InvalidOperationException: Cannot find the fallback endpoint specified by route values: { page: /_Host, area: }.
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DynamicPageEndpointMatcherPolicy.ApplyAsync(HttpContexthttpContext,CandidateSetcandidates)

I have made no code changes.

Reverting to Preview-7 by removing the RC1 SDK (per the instructions here) resolved the problem and the app starts as expected.

Is there a breaking change between Preview7 and RC1 I've missed that means I need to make code-changes. I had a look at the breaking changes list but couldn't spot anything that didn't happen in earlier previews.

Exceptions (if any)

InvalidOperationException: Cannot find the fallback endpoint specified by route values: { page: /_Host, area: },
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.DynamicPageEndpointMatcherPolicy.ApplyAsync(HttpContexthttpContext,CandidateSetcandidates)
Microsoft.AspNetCore.Routing.Matching.DfaMatcher.SelectEndpointWithPoliciesAsync(HttpContexthttpContext,IEndpointSelectorPolicy[]policies,CandidateSetcandidateSet)
Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>g_AwaitMatch|8_1(EndpointRoutingMiddlewaremiddleware,HttpContexthttpContext,TaskmatchTask)
Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContextcontext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContextcontext)

Further technical details

  • ASP.NET Core version: 6.0.100-rc.1.21458.32
  • IDE: VS for Mac 2022 Preview
  • OS: MacOS Monterey 12.0 Beta (21A5506j)
@javiercn
Copy link
Member

@Webreaper thanks for contacting us.

We've identified that the underlying issue for this is a bug in the razor source generator that prevents the views from being compiled into the assembly

You can try use

<PropertyGroup>
  <UseRazorSourceGenerator>false</UseRazorSourceGenerator>
</PropertyGroup>

@Webreaper
Copy link
Author

Thanks for the quick turnaround @javiercn. Confirmed that adding that flag fixes the problem.

Will re-test without it when RC2 comes out! :)

Webreaper added a commit to Webreaper/Damselfly that referenced this issue Sep 15, 2021
@javiercn
Copy link
Member

/cc: @pranavkm FYI

@Pilchie Pilchie added the area-blazor Includes: Blazor, Razor Components label Sep 15, 2021
@pranavkm
Copy link
Contributor

@Webreaper the source generator that you disabled relies on C# 10 features that is not currently supported by the preview of VS4Mac. This should be resolved in the next VS4Mac preview release that is expected to become available in a couple of weeks. In the meanwhile, feel free to continue using the workaround that @javiercn provided.

FYI @jmatthiesen

@Webreaper
Copy link
Author

Ooooh, interesting to know. Thanks for the details @pranavkm. The joys of living on the bleeding edge. 😁

Out of interest, what's the impact of disabling source generators for this? Is it just compile-time performance, or is anything else lost?

@pranavkm
Copy link
Contributor

There's some performance improvements in using the source generator, but the biggest benefit is in being able to hot reload .razor and .cshtml files. It does not help with VS4Mac right now as we haven't done the work to enable hot reload, but having it off would prevent hot reload for .razor / .cshtml from working in VS and dotnet-watch.

@Webreaper
Copy link
Author

Thanks, that's really useful background!

@mattgenious
Copy link

Seems to also be the case for Visual Studio 16.11.3 Preview 1.0 on Windows 11 Pro Version 10.0.22000 Build 22000 with the .NET 6 RC1 SDK installed.

Doesn't work with the flag added for me on Visual Studio 16.11.3 Preview 1.0.

Works with or without the flag added for me on Visual Studio 2022 17.0.0 Preview 4.

@javiercn javiercn added ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question labels Sep 17, 2021
@ghost ghost added the Status: Resolved label Sep 17, 2021
@ghost
Copy link

ghost commented Sep 18, 2021

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.

@ghost ghost closed this as completed Sep 18, 2021
@Webreaper
Copy link
Author

Just to close the loop - confirmed that Blazor works fine without UseRazorSourceGenerator=false within VS2022 for Mac build 3569.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-source-generators ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved
Projects
None yet
Development

No branches or pull requests

5 participants