Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the WinForms minimal example, I noticed an issue where the "onunload" event doesn't seem to be firing if you click File > Exit. I think this is related to CefSharp issue #1574, where there's a bit of a race condition when you call
browser.Dispose()
before removing the browser from the holding control.In my case, the website I'm trying to embed relies on the onunload event to fire an Ajax/fetch request that logs the user out. With the current example setup, the event is firing but (almost) every time the browser is torn down before the Ajax can send. I can even see the TCP/TLS connection for my Ajax call start (in Fiddler) but then don't see the request body sent out.
If I update the example to remove the browser from the control before Disposing the browser, I consistently see my calls complete!
I think it would make sense to add this to the minimal example to show others a simple way to handle this, with a comment referencing the issue above. There are more complicated ways to handle this like implementing
ILifespanHandler.DoClose
. That and more already seems to be covered in the larger WinForms example.