-
Notifications
You must be signed in to change notification settings - Fork 632
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
Make webview2 disposal safer #14888
Make webview2 disposal safer #14888
Changes from 44 commits
c45a3da
135de06
32aaa28
5129a93
8c2c694
cf3c37d
b0ec268
4cc32b2
7cf5cbd
6c3add2
5e90045
6d062dd
b58be3d
aee8814
697b33d
e047f1e
a3a9cd7
f85d5f4
f6a9aad
516b73d
241a7da
30cc0fd
84a280b
f4ee178
3d31d55
b27a3c4
2c34283
d25719f
984cc8d
6d35115
95ace8c
b9846f7
e4dcf57
9ebd4b0
eaebcca
6867e6c
3882214
4103d57
b88d49c
7216377
7ae0cb0
befb456
f3cd594
d5ff0b0
f7db55d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,22 +170,30 @@ async void InitializeAsync() | |
}; | ||
} | ||
|
||
//Initialize the CoreWebView2 component otherwise we can't navigate to a web page | ||
await documentationBrowser.EnsureCoreWebView2Async(); | ||
|
||
this.documentationBrowser.CoreWebView2.WebMessageReceived += CoreWebView2OnWebMessageReceived; | ||
comScriptingObject = new ScriptingObject(this.viewModel); | ||
//register the interop object into the browser. | ||
this.documentationBrowser.CoreWebView2.AddHostObjectToScript("bridge", comScriptingObject); | ||
|
||
this.documentationBrowser.CoreWebView2.Settings.IsZoomControlEnabled = true; | ||
this.documentationBrowser.CoreWebView2.Settings.AreDevToolsEnabled = true; | ||
|
||
initState = AsyncMethodState.Done; | ||
try | ||
{ | ||
//Initialize the CoreWebView2 component otherwise we can't navigate to a web page | ||
await documentationBrowser.Initialize(Log); | ||
|
||
this.documentationBrowser.CoreWebView2.WebMessageReceived += CoreWebView2OnWebMessageReceived; | ||
comScriptingObject = new ScriptingObject(this.viewModel); | ||
//register the interop object into the browser. | ||
this.documentationBrowser.CoreWebView2.AddHostObjectToScript("bridge", comScriptingObject); | ||
|
||
this.documentationBrowser.CoreWebView2.Settings.IsZoomControlEnabled = true; | ||
this.documentationBrowser.CoreWebView2.Settings.AreDevToolsEnabled = true; | ||
|
||
initState = AsyncMethodState.Done; | ||
} | ||
catch(ObjectDisposedException ex) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we be catching other exceptions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ObjectDisposedException is the only exception type that we should expect to happen, and mostly in tests. It should not trigger crashes and Dynamo should be able to go on running. |
||
{ | ||
Log(ex.Message); | ||
} | ||
|
||
} | ||
//if we make it this far, for example to do re-entry to to this method, while we're still | ||
//initializing, don't do anything, just bail. | ||
if(initState == AsyncMethodState.Done) | ||
if (initState == AsyncMethodState.Done) | ||
{ | ||
if (Directory.Exists(VirtualFolderPath)) | ||
{ | ||
|
@@ -211,11 +219,6 @@ private void CoreWebView2OnWebMessageReceived(object sender, CoreWebView2WebMess | |
/// </summary> | ||
public void Dispose() | ||
{ | ||
if (initState == AsyncMethodState.Started) | ||
{ | ||
Log("DocumentationBrowserView is being disposed but async initialization is still not done"); | ||
} | ||
|
||
Dispose(true); | ||
GC.SuppressFinalize(this); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this job that is called dynamo core windows built for platform linux?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it tries to build DynamoCore for Linux on a windows machine. Maybe we thought it was a valuable scenario (build on windows but target linux)