-
Notifications
You must be signed in to change notification settings - Fork 51
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
Visual Studio crashes on WebView2 dispose when hosted in multiple tool windows #816
Comments
Thanks for the bug report - I've opened it on our backlog. |
This should be fixed in the latest 1.0.790-prerelease SDK package. Thanks! |
This doesn't seem to be fixed in the latest runtime v89.0.774.45 |
@priyasgs Which SDK version are you using? The fix doesn't depend on a specific runtime, just the latest 1.0.790-prerelease SDK package. |
Not fixed in the latest stable SDK release 1.0.774.44 |
@priyasgs Have you been able to try it using the 1.0.790-prerelease SDK? It was fixed in version 789, so I wouldn't expect the 1.0.774.44 release to have the fix working. |
@champnic no I haven't. I can try that, and then wait for the next stable release to include the fix so I can ship it as part of our product. |
@priyasgs - did issue got resolved for you? I am also getting same error while trying to close the WPF application using X (close) icon. This error is causing when I am trying to dispose webView2. I might be doing some very common mistake.... but not able to identify why following error is coming. OS: Win 10 Code causing error: Steps to reproduce:
One more observation from my end:
Description: The process was terminated due to an unhandled exception. |
@priyasgs - this issue has been resolved by updating webView2 version to 1.0.824-prerelease. Thanks everyone!! |
@champnic - as mentioned above the issue has been fixed in 1.0.824- prerelease. But as per Microsoft documentation we should not use prerelease for production environment. I am using this.focus() as work around for above mentioned error for our production product. Can you please let me know when will be 1.0,824 will be stable version? I have tried to find in road map link, but no luck. |
Typically the code in a prerelease package will be in the following release package, usually 6 weeks later. |
I can confirm the original issue I saw is now fixed in the latest stable 1.0.818.41 release. I don't need to workaround the focus issue anymore. |
@priyasgs Thanks for confirming! |
I have a Visual Studio 2015 extension with a tool window that hosts WebView2. User can open multiple instances of the same, and hence I dispose the underlying WebView2 when the tool window is closed. In case an editor is open when the last such tool window is closed, I see a crash on WebView2.Dispose():
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147019873
HResult=-2147019873
Message=The group or resource is not in the correct state to perform the requested operation. (Exception from HRESULT: 0x8007139F)
Source=Microsoft.Web.WebView2.Core
StackTrace:
at Microsoft.Web.WebView2.Core.Raw.ICoreWebView2Controller.MoveFocus(COREWEBVIEW2_MOVE_FOCUS_REASON reason)
at Microsoft.Web.WebView2.Core.CoreWebView2Controller.MoveFocus(CoreWebView2MoveFocusReason reason)
at Microsoft.Web.WebView2.Wpf.WebView2.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndHost.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
InnerException:
I saw a similar issue at #333 (comment)
I am attaching a sample with the scenario I described:
EdgeDisposeCrash.zip
Here are the exact steps to reproduce the problem with the sample
Visual Studio crashes. Uncomment the following 2 lines in the tool window's Dispose method:
//var window = dte.ActiveWindow;
//window.Activate();
Try the same steps, this time there is no crash. What am I doing wrong? There are other hosting scenarios I plan to implement with WebView2, and I cannot apply the same workaround in each such place. What is the way out?
AB#31402308
The text was updated successfully, but these errors were encountered: