-
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
Closing Wpf app with WebView2 gives exception #640
Comments
As workaround I now subscribe on the form closing event and explicity dispose the WebView2 control. This should not be needed, because Wpf doesn't really support lifetime management / dispose pattern like WinForms does |
Glad you have a workaround - I've added this bug to our backlog and we'll try to improve the experience. Thanks! |
Observed the same error message. Does a time table already exist to fix it? |
I experience the same error. If a user navigated to 'edge://'and then closes the control, it throws this exception when it tries to dispose the 'host control' |
This type of error can come from a few different sources.
@GeorgHue I think you are seeing an instance of 4) - we recently put in a fix for this type of issue and it should be available to test in our next prerelease package (hopefully this week or early next). @dqwork You are seeing an instance of 2) due to a browser crash mentioned in #604. We have a fix for that and it will also be available in the next prerelease package. |
@champnic Thanks for the info |
@champnic Also many thanks for your infos! Additional info to my error message above: It happened when logging off my system while WebView2 is in use. |
One of the issues I ran into is that when the WebView2 isn't done yet initializing and you then dispose it it also crashes. This happens, because I have the webview2 on a dockable panel and if I toggle this panel very quickly on and off this happens |
If u called the AddScriptToExecuteOnDocumentCreatedAsync, then u could call the "RemoveScriptToExecuteOnDocumentCreated" before the win closed. |
In WebView 2 runtime 94.0.992.31 I still get "The group or resource is not in the correct state to perform the requested operation. (Exception from HRESULT: 0x8007139F)" during logoff. Is there any fix or workaround in sight? |
@GeorgHue Is it still the same stack? Is the WebView2 only being disposed once, and being torn down on the thread it was created on? Notable, the finalizer often calls dispose on a background thread which can cause issues. |
@njannink We assume that if we log off from the system, Outlook is terminated and then it is not able calling shutdown to our addin. Here is our current stack: |
I have no idea what your are trying to ask and what Outlook has to do with it. |
@njannink Sorry for my unclear comment above! 😳 In fact we use WebView2 as Outlook addin viewing component. If we close Outlook, WebView2 is also closed with no problems. But logging of from the system closes Outlook immediately and WebView2 crashes. |
I can confirm the same error and callstack as posted by @njannink. Please find attached a zip file with a minimal repro solution. I also can confirm that the work around helps. But this is not practical at all. Version Repro Steps
|
Has this ever been fixed? This seemed to have been fixed in 1.0.1072.54. I recently upgraded to 1.0.1293.44 and this one has reared its ugly head again. Even reverting back to 1.0.1072.54 doesn't fix it for me anymore. |
Hey @Shujee - No I don't think this had been fixed before. I'm not sure what might have changed in the running of your app, but that would explain why going back to 1.0.1072.54 didn't fix it. However, we did just put in a fix, and it should be available in the next prerelease SDK. |
Thanks @champnic . Just in case this helps you guys, I just found that this problem can be avoided by explicitly calling Still looks like a bug to me that I don't have to |
Yup this is a known workaround, though most folks don't want to have to call Dispose() - as you noted, it's not common in WPF. We explicitly need Dispose to be called at some point, because the instance of a WebView2 WPF control is tied to large/multiple browser processes that should be cleaned up when possible. |
This should be fixed in SDK 1.0.1369-prerelease. Thanks! |
Description
When closing my application I get a
COMException - The group or resource is not in the correct state to perform the requested operation. (Exception from HRESULT: 0x8007139F)
. And I don't seem to be able to catch it anywhere.Version
SDK: 1.0.674-prerelease
Runtime: 86.0.622.69
Framework: Wpf
OS: Win10
Repro Steps
Close application
AB#30787253
The text was updated successfully, but these errors were encountered: