-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Bug] MAUI Blazor - Router AppAssembly could not find pages if assembly is different #3258
Comments
You need to tell the Router that there are additional assemblies to scan for routes by setting the "AdditionalAssemblies" property, so something like:
|
I just tried this with AdditionalAssemblies and it worked fine. In my MAUI app project I have
And in some page in the main app I have this navigation link: <a href="/page1">Page1</a> And in my Razor Class Library (RCL) I have a file
And when I click the link, it correctly loads the |
It looks same as mine. But I will try it again asap. |
I think I found the difference. In your repro app the file
If you change it to just this;
Then it should work. |
BTW there is actually a hidden exception that says something about a duplicate route, which makes sense, because the main assembly has everything duplicated, but unfortunately that hidden exception just makes Blazor fail to load. So I think there are two unrelated bugs here:
|
Thank you so much!
8 Ara 2021 Çar 03:23 tarihinde Eilon Lipton ***@***.***> şunu
yazdı:
… I think I found the difference. In your repro app the file
BlazorShared.Native\Main.razor has the app assembly also listed as an
AdditionalAssembly:
AdditionalAssemblies="new[]{GetType().Assembly, typeof(BlazorShared.Docs.Pages.Index).Assembly}">
If you change it to just this;
AdditionalAssemblies="new[]{typeof(BlazorShared.Docs.Pages.Index).Assembly}">
Then it should work.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3258 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4VERO26ERRIILFW33JPJDUP2QPTANCNFSM5HLOBDLQ>
.
|
I filed these issues:
But I think the specific issue in this bug is resolved, so I'm closing this out. Very interesting issue 😄 |
Description
I am building a blazor project which has a common razor library. WASM and Blazor server uses same project to serve pages and components. I have added a new MAUI Blazor project and referenced the library. Project builds and runs but Router couldn't find the pages. It just show a white blank screen. I am adding a sample project for reproducing.
Expected Behavior
It should run like Blazor Server and Blazor WASM.
Actual Behavior
Router can find MainLayout but cannot find the actual page.
Screenshots
MAUI Blazor - Not Working Blank Screen
Blazor WASM - Working
Blazor Server - Working
What I have tried
Reproduction Link
BlazorSharedProject.zip reproducing project
The text was updated successfully, but these errors were encountered: