Skip to content
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

[Problem/Bug]: Profile deleted immediately upon calling Delete rather than being scheduled for when the browser process exits #4491

Closed
pushkin- opened this issue Apr 17, 2024 · 2 comments
Assignees
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@pushkin-
Copy link

pushkin- commented Apr 17, 2024

What happened?

not clear if functional issue or just a doc issue, but Profile::Delete remarks say:

After the API is called, the profile will be marked for deletion. The local profile's directory will be deleted at browser process exit.

However, I'm seeing it get deleted immediately, and so when I go to do something with CoreWebView2 like call Navigate(), I run into:

System.InvalidOperationException: CoreWebView2 members cannot be accessed after the WebView2 control is disposed

Am I misunderstanding the docs, or do they need to be update? Or is it unexpected that the directory gets deleted immediately?

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

123.0.2420.97

SDK Version

1.0.2277.86

Framework

Winforms

Operating System

Windows 10

OS Version

22H2 - OSBuild 19045.4170

Repro steps

notice this when calling Profile.Delete() and then calling a CoreWebVIew2 function

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

AB#51575447

@pushkin- pushkin- added the bug Something isn't working label Apr 17, 2024
@pushkin- pushkin- changed the title [Problem/Bug]: Profile deleted immediately upon calling Deleted rather than being scheduled for when the browser process exits [Problem/Bug]: Profile deleted immediately upon calling Delete rather than being scheduled for when the browser process exits Apr 18, 2024
@pushkin-
Copy link
Author

pushkin- commented Apr 18, 2024

there's a hint here where it says:

When this event is raised, the CoreWebView2Profile and its corresponding CoreWebView2s have been closed...

So yeah it's closing/disposing the CoreWebView2 which leads to the problem

So this bit makes sense then:

The local profile's directory will be deleted at browser process exit

Maybe the Delete() method docs need to also mention that we're getting rid of CoreWebView2 rather than just saying:

Delete this profile.

Or is that somehow implied?

@peiche-jessica peiche-jessica added the tracked We are tracking this work internally. label Jun 4, 2024
@peiche-jessica
Copy link
Collaborator

Hi @pushkin- In the remarks, we also mention that

The corresponding CoreWebView2s will be closed and the CoreWebView2Profile.Deleted event will be raised.

The local profile's directory may not be deleted immediately but the corresponding CoreWebView2 will be closed upon the Delete() call. I will make sure we update the docs to make it more clear on that. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

2 participants