-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
Using the suggested method for a WPF-Blazor hybrid app, an exception is thrown if any of the blazor pages is set to an interactive server render mode #33509
Comments
Hello @fltrierweiler ... Stand-by for sec, while I get an update on the WPF (and WinForms for that matter) + BWA plan ... @danroth27 @mkArtakMSFT ... IIRC from earlier discussion, including with @BethMassi, I thought we're not supporting WPF (per this tutorial's guidance) with BWA in the framework/docs. Is that correct? If so, I'd like to add a remark at the tops of the WPF and WinForms tutorials and steer devs to the MAUI+BWA tutorial. |
Hey @guardrex, thank you for your reply! I managed to find a workaround for this issue, at least for my specific problem. Turns out that the FluentUI Dialog components don't really need interactivity to work when I'm using them in the WPF version of the app, so I changed the project to set the render mode only for the web version, and now everything is working fine. Can I close this issue? |
Thanks for letting us know, @fltrierweiler. Let's leave this issue open for a bit. Beth is OOF at the moment. We probably need some kind of remark in WinForms and WPF coverage to steer devs to the MAUI article/sample if they want Blazor Web App features. This issue will close automatically later when the PR merges. |
@guardrex the same pattern that we describe in the .NET 8 version of the MAUI Blazor Hybrid + Web sample would apply here as well. You need to add the InteractiveRenderSettings class to the shared RCL and then call the ConfigureBlazorHybridRenderModes method from the startup on the hybrid app. Also, it is likely we won't finish this work item dotnet/aspnetcore#51235 so the same pattern would apply in .NET 9. Hope this helps! |
Is the plan to overhaul those two articles to demonstrate the same pattern or leave them as they are and tell devs in the articles to implement the pattern explained by the MAUI article if they wish to support a BWA with their WinForms or WPF app? ... or perhaps do nothing at this time? |
I think we can leave the Winforms/WPF content as is. We do need some updates to the .NET 9 MAUI version of this one though. We're not going to get the fix in for ignoring the rendering modes in Blazor hybrid apps so we need to add instructions on how to add the InteractiveRenderSettings class. It's pretty straightforward using the new maui-blazor-web template though. I wrote it up and provide a sample here: https://github.com/BethMassi/BlazorHybridWebDemo |
I'm confused. A (plain) MAUI Blazor app doesn't include a Blazor (web) app. It just sets up a root component in <RootComponent Selector="#app" ComponentType="{x:Type local:Components.Routes}" /> For ...
Isn't that all covered by the work we did earlier in the new MAUI Blazor with BWA article? ....
I thought that would just mean that we won't need to make any 9.0 updates to that article. |
Ah sorry, I thought this was a discussion about sharing RCL with Blazor hybrid which this class addresses. And yes, this is covered in that article in the per page/component https://learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/tutorials/maui-blazor-web-app?view=aspnetcore-8.0#per-pagecomponent-server-interactivity We should make a note about this in the .NET 9 version as well. |
You're right ... I changed the subject a little in using this issue to discuss if a web app RCL version of the WPF and WinForms articles would be written up. I understand that the answer on that is 'no' for now. I'm not sure what note you mean to add. A note about what? ... and where? |
I think somewhere in this section? https://learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/tutorials/maui-blazor-web-app?view=aspnetcore-9.0#use-blazor-render-modes we should make a note about needing this class if you do want to support per page / component rendering modes. |
Description
Is there any way to solve this?
Basically, there are a few pages in my app that must use
@rendermode @(new InteractiveServerRenderMode(prerender: false))
. I need the interactivity to use FluentUI Dialog components.The web version works fine, but if I try to launch the WPF app, it immediately runs into the following exception:
I've tried adding
services.AddRazorComponents().AddInteractiveServerComponents();
to the Form constructor, but that gives me another exception:So now I'm stuck and I can't find any documentation providing answers. Is there a way to solve this?
Page URL
https://learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/tutorials/wpf?view=aspnetcore-8.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/hybrid/tutorials/wpf.md
Document ID
94872f14-0dce-0cf3-0d25-88f23ca8d8ef
Article author
@guardrex
The text was updated successfully, but these errors were encountered: