-
Notifications
You must be signed in to change notification settings - Fork 635
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
Dyn 5107 webview2 update in guided tours #13142
Dyn 5107 webview2 update in guided tours #13142
Conversation
I replaced the WebBrowser component used in Guided Tours by WebView2. The WebBrowserWindow was removed due that the component was inserted directly in the PopupWindow. Also I noticed that some code for hiding the Guided Tour Popups when Dynamo is in background was producing a crash in the WebView2 component, then I removed the code in GuidesManager.cs.
webBrowserWindow.IsOpen = false; | ||
if (webBrowserComponent != null) | ||
{ | ||
webBrowserComponent.Visibility = Visibility.Collapsed; |
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.
@RobertGlobant20 Can you explain when is the webBrowserComponent
disposed?
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.
@QilongTang the WebView2 control is created every time the Popup is opened and disposed when the Popup is Hidden (specifically in the Step.Hide() method that is executed when we click the next or prev Popup button), the problem with Popup.IsOpen = false is that it generates an async call to Popup.OnClose() so if we don't dispose the WebView2 instance before we close the PackageManagerSearch, the WebView2 crashes (in the image below you will see that we set IsOpen = false and then we execute the UIAutomation Steps - inside one of this we are closing PackageManagerSearch).
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.
@RobertGlobant20 Gotcha, thanks!
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.
A few comments then LGTM
/// <param name="bodyHtmlPage">Html page string</param> | ||
/// <param name="resources">Resources to be loaded</param> | ||
/// <returns></returns> | ||
private string LoadResouces(string bodyHtmlPage, Dictionary<string, string> resources) |
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.
Maybe a good thing is to add those methods in the Utils class, so they can be reused. (For example in our notifications extension method). Let me know your opinion about it.
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.
The methods LoadWebBrowser, LoadResouces and LoadResourceAndReplaceByKey were moved to the ResourceUtilities class so they can be used in other places, please check the next commit:
f8c0b4b
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.
LGTM
The methods LoadWebBrowser, LoadResouces and LoadResourceAndReplaceByKey were moved to the ResourceUtilities class so they can be used in other places
Thank you @RobertGlobant20 , I will need to build your fork to understand the performance impact. Although we talked about replacing the browser for Guided Tour being easiest :) My gut feeling is that, it actually impact performance most since other places, the WebView2 component will not be initialized and disposed with such frequency.. |
@QilongTang yes, as you said I was thinking that this should be the easiest one but there was an issue happening when passing from Step7 to Step8 in the Packages guide that took me more time. Something that we will need to research is what happens when the WebView2 is hidden or collapsed, since I noticed that the CoreWebView2 is disposed automatically (also applies if is inside a Popup and is hidden, the CoreWebView2 instance is disposed), so we need to re-initialized again calling EnsureCoreWebView2Async and reloading the page, so probably in flows in which we are hiding the LibraryView or the DocumentationBrowser we will need to do that. |
Purpose
I replaced the WebBrowser component used in Guided Tours by WebView2.
The WebBrowserWindow was removed due that the component was inserted directly in the PopupWindow.
Also I noticed that some code for hiding the Guided Tour Popups when Dynamo is in background was producing a crash in the WebView2 component, then I removed the code in GuidesManager.cs.
In PopupWindow.xaml.cs added the code needed for loading the html page in the WebView2 compoonent.
Declarations
Check these if you believe they are true
*.resx
filesRelease Notes
I replaced the WebBrowser component used in Guided Tours by WebView2.
Reviewers
@QilongTang
FYIs