-
Notifications
You must be signed in to change notification settings - Fork 636
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
Webview2 initialization #14671
Webview2 initialization #14671
Conversation
this.documentationBrowser.DpiChanged -= DocumentationBrowser_DpiChanged; | ||
|
||
if (this.documentationBrowser.CoreWebView2 != null) | ||
if (this.documentationBrowser != null) |
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.
code here was just moved under a null check
src/DocumentationBrowserViewExtension/DocumentationBrowserViewExtension.cs
Show resolved
Hide resolved
@@ -422,6 +414,8 @@ private void Browser_Loaded(object sender, RoutedEventArgs e) | |||
{ | |||
string msg = "Browser Loaded"; | |||
LogToDynamoConsole(msg); | |||
|
|||
InitializeAsync(); |
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.
We initialize webview2 only after it is loaded as part of the visual tree (Browser_Loaded)
@@ -48,7 +48,7 @@ public void UpdateNotificationWindowSize(int height) | |||
} | |||
} | |||
|
|||
public class NotificationCenterController | |||
public class NotificationCenterController : IDisposable |
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.
proper disposable
src/DocumentationBrowserViewExtension/DocumentationBrowserView.xaml.cs
Outdated
Show resolved
Hide resolved
* update * update * Update DocumentationBrowserView.xaml.cs * update * Update DocumentationBrowserView.xaml.cs * update * update --------- Co-authored-by: pinzart <[email protected]>
OK, waiting for the final checks then I will merge |
@@ -162,6 +165,9 @@ public void ViewExtensionIgnoresExternalEvents() | |||
// Act | |||
var tabsBeforeExternalEventTrigger = this.ViewModel.SideBarTabItems.Count; | |||
viewExtension.HandleRequestOpenDocumentationLink(externalEvent); | |||
DispatcherUtil.DoEventsLoop(); | |||
|
|||
Assert.AreEqual(AsyncMethodState.NotStarted, viewExtension.BrowserView.initState); |
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 is it not started here? Won't webview2 initialization be complete by this point?
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.
using an externalLink will not startup webview2.
That is what the test is verifying
This reverts commit cfaceb2.
Part of the many issues during testing (and not only):
EnsureCoreWebView2Async
until the control is visible.Pretty good description here.
I tried to move most of the webview2 initialization calls in the Loaded callback (basically after the webview2 control is added to the visual layout). DocumentationBrowser's webview2 has not been refactored in such a way because it is used in slightly more complicated workflows.
An example of buggy behavior:
This might cause crashes, memory leaks etc.