ChromiumDotNet / Chromium.AspNetCore.Bridge

Chromium.AspNetCore.Bridge
Apache License 2.0
25 stars 9 forks source link

Could this be made to work with BlazorWebView - in Hybrid Wpf App #9

Open mediabuff opened 1 year ago

mediabuff commented 1 year ago

In MainWindow.xaml, I replace the webview control and took necessary steps in wiring the resource handlers. I get 'System.UriFormatException' when the view gets rendered.

New `

` Old `` my Index.cshtml ` BlazorApp2Demo @(await Html.RenderComponentAsync(RenderMode.Static, new { SectionName = "HeadCss" }))
Loading...
An unhandled error has occurred. Reload 🗙
@(await Html.RenderComponentAsync(RenderMode.Static, new { SectionName = "BodyScripts" })) `
amaitland commented 1 year ago

Could this be made to work with BlazorWebView

Interesting idea. Not something I've tired, so it's unclear if it's possible.

'System.UriFormatException' when the view gets rendered.

What is the stack trace for the exception?

If you can, create a new example project then create a PR, even if it's not working I'll be able to see exactly what you've done. As it is now you've only provided code fragments, not enough for me to know what's going on.

mediabuff commented 1 year ago

Ok, I will try to recreate this in a smaller, boilder plate WPF hybrid blazor app. Please give me couple of days.

mediabuff commented 1 year ago

Hi, please see attached Blazor.AspNetCore.Bridge.zip

Normall, Blazor server apps start with "_host.cshtml", a razor view that can dynamically configure the SPA page. Microsoft has not done the same for Blazor Hyrbid Wpf App. The start up here is "index.html". Essentially, to start with I will be nice have "index.cshtml" Now, this can be broadly expanded to include any Razor view in Blazor Hybrid. Today they only support Blazor(Razor Components - aka - *.razor files.

Micrsoft seems to go in the direction of supporting Client Side Rendering tech on the Server.

Server-side rendering with Blazor components https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-3/ See https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-2/ https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-1/

What they may not support is Client-side rendering of Server razor views. Blazor.AspNetCore.Bridge.zip

I had raised this with MS https://github.com/dotnet/aspnetcore/issues/47613

mediabuff commented 1 year ago

You may use the following libray to add some components to "index.cshtml" for testing purposes https://github.com/inspgadget/BlazorSections

amaitland commented 1 year ago

please see attached Blazor.AspNetCore.Bridge.zip

I don't review zip files. Needs to be a PR against this repo that adds a blazor example that reproduces the exception you've reported above.

mediabuff commented 1 year ago

oh, well. I am not familiar with how to do that as this is not simple few lines of bug. This is an architectural enhancement - that is the reason I gave you the source for the full project.

I thought I could peek your interest. Sorry! I will seek another route.

amaitland commented 1 year ago

I replace the webview control and took necessary steps in wiring the resource handlers. I get 'System.UriFormatException' when the view gets rendered.