Open
Description
What happened?
When you try to initialize Webview2 by using the Source
property from WPF hosted in a Visual Studio extension and have CreationProperties
set, you will get a weird ArgumentException on WPF/XAML trying to set CreationProperties
and the webview will fail to initialize. Doing the exact same thing but using EnsureCoreWebView2Async
and Navigate
instead of the Source
property does work.
System.Windows.Markup.XamlParseException
HResult=0x80131501
Message='Set property 'Microsoft.Web.WebView2.Wpf.WebView2Base.CreationProperties' threw an exception.' Line number '19' and line position '10'.
Source=PresentationFramework
StackTrace:
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
This exception was originally thrown at this call stack:
System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, object, System.Windows.PropertyMetadata, bool, bool, System.Windows.OperationType, bool)
System.Windows.Baml2006.WpfMemberInvoker.SetValue(object, object)
MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(object, System.Xaml.XamlMember, object)
Inner Exception 1:
ArgumentException: 'Microsoft.Web.WebView2.Wpf.CoreWebView2CreationProperties' is not a valid value for property 'CreationProperties'.
Importance
Low. My app is not very affected, or this only affects development.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
133.0.3065.69
SDK Version
1.0.3065.39
Framework
WPF
Operating System
Windows 11
OS Version
10.0.26100.0
Repro steps
- Clone https://github.com/segevfiner/Webview2FocusIssueVSIX
- Open the solution in Visual Studio.
- Run it (F5).
- Press View -> Webview2 Not Working.
- You will get an error.
- Close the experimental Visual Studio instance, and open it again (F5)
- Press View -> Webview2 Working.
- It will work.
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
Don't know
Last working version (if regression)
No response
Activity