MicrosoftEdge / MicrosoftEdge/WebView2Feedback
CoreWebView2 members cannot be accessed after removing DownloadStarting event
@vickiez is already working on this.
Since Aug 31, 2023.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Description
In our application we seem to dispose the WebView2 (and CoreWebView2) objects before we remove their event handlers. We have always done it this way and so far it has worked with all event handlers, for Microsoft-based controls and for other controls.
Now we have added the DownloadStarting event and we are trying to remove it in a similar manner, however we get an exception:
Exception : System.InvalidOperationException: CoreWebView2 members cannot be accessed after the WebView2 control is disposed. ---> System.Runtime.InteropServices.COMException: The group or resource is not in the correct state to perform the requested operation. (Exception from HRESULT: 0x8007139F)
at Microsoft.Web.WebView2.Core.Raw.ICoreWebView2_4.remove_DownloadStarting(EventRegistrationToken token)
at Microsoft.Web.WebView2.Core.CoreWebView2.remove_DownloadStarting(EventHandler1 value) --- End of inner exception stack trace --- at Microsoft.Web.WebView2.Core.CoreWebView2.remove_DownloadStarting(EventHandler1 value)
Is this something that can be fixed on your end? We rely on the behavior that event handlers can still be removed even though the object it is attached to is disposed.
Version
SDK: 1.0.1938.49
Runtime: 117.0.2045.12 beta
Framework: WinForms
OS: Win10, Version 22H2 (Build 22621.2134)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.