Open carsten-riedel opened 1 year ago
I noticed the same thing recently while trying to use WebView2 Fixed Runtime. I was certain I tried using BlazorWebViewInitializing at one point and it worked as expected. So either I mis-remembered it, or maybe something changed in BlazorWebView (somewhat unlikely that this specific area changed), or in WebView2 (certainly possible).
So for now the best workaround I'm aware of (that you've seen as well) is to set the environment variable (which affects all WebView2's in the app, which is likely what you want anyway):
Environment.SetEnvironmentVariable("WEBVIEW2_BROWSER_EXECUTABLE_FOLDER", @"C:\Temp\WebViewRuntime\Microsoft.WebView2.FixedVersionRuntime.113.0.1774.57.x64");
Description
On windows desktop platform blazorwebview.blazorwebviewinitializing has no effect.
As stated on the official documentation. https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.webview.maui.blazorwebview.blazorwebviewinitializing?view=net-maui-7.0
Raised before the web view is initialized. On some platforms this enables customizing the web view configuration.
Please list current platforms where this has effect.
Please make this feature available for MAUI windows desktop applications.
Public API Changes
Enable Webview.maui.blazorwebview.blazorwebviewinitializing for windows desktop
Intended Use-Case
I had recently some problems with the Datalist from WebView Runtime inside MAUI app.
See for reference here. https://github.com/MicrosoftEdge/WebView2Feedback/issues/3496
I wanted to influence the WebView Runtime Startup parameters. To use another BrowserExecutableFolder
See https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.webview.blazorwebviewinitializingeventargs?view=net-maui-7.0
In this case i followed the MAUI documentations first, but that only led me to a dead end.
I need some relay reliable official way to influence the WebView Runtime versions used, if I rollout an application to production and then there is an issue with the underlying WebView runtime there is no official documentation how to deal with it. The blazorwebview.blazorwebviewinitializing seemed to be supposed for that but yeah it basically not works for windows desktop.