Answer the question
In order to leave comments, you need to log in
Why does a deadlock or something like that happen?
private string GetHTMLFromWebBrowser()
{
// Get the html source code from the main Frame.
// This is displaying only code in the main frame and not any child frames of it.
Task<String> taskHtml = browser.GetBrowser().MainFrame.GetSourceAsync();
string response = taskHtml.Result;
return response;
}
private void WebBrowserFrameLoadEnded(object sender, FrameLoadEndEventArgs e)
{
html = GetHTMLFromWebBrowser();
Answer the question
In order to leave comments, you need to log in
Result of Task is a blocking operation. Here is more about deadlock
. I would do this - waiting for the completion of an async operation in a separate thread - upon completion of waiting for the event, the subscriber of which will update the data on the form.
Task<String> taskHtml = browser.GetBrowser().MainFrame.GetSourceAsync();
string response = taskHtml.Result;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question