|
Rank: Member Groups: Member
Joined: 11/13/2015 Posts: 29
|
Looks like it is waiting forever. This is what I'm doing:
Code: C#
var task = WebView.LoadRequest(request);
Task.Factory.StartNew(() => {
task.WaitOne();
logger.Debug("done");
});
But as mentioned, task.WaitOne() never releases. Any ideas?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, Your code is correct. The only thing is you must make sure that the thread that created the WebView continue to pump message. WebView relies on windows messages to function. So the thread must run a windows message loop. For example, assume you have a Windows Form application with "button1" and use the following code handle button1's Click event:
Code: C#
function button1_Click(object sender, EventArgs e)
{
var task = WebView.LoadRequest(request);
Task.Factory.StartNew(() => {
task.WaitOne();
logger.Debug("done");
}).Wait(); //This Wait call will cause deadlock
}
This code will deadlock because the calling thread is blocked forever on the last line and it will never have a chance to continue dispatch windows messages. However the WebView won't be able to finish loading Url until a number of messages are dispatched. If your code does not block after LoadRequest and return immediately thus return control to the message loop, then it will work. Hope this helps. Please feel free to let us know if you still have any questions. Thanks!
|
|
Rank: Member Groups: Member
Joined: 11/13/2015 Posts: 29
|
Thanks for the quick reply. The code I provided is executed using a dispatcher on a wpf window. The window is still working and the page does load. I am getting the load event, but the task waiter does not release.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
In that case please try to isolate the problem into a test project and send the test project to us. We will look into it as soon as we receive that. See here for more information on how to submit test project: http://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|
Rank: Member Groups: Member
Joined: 11/13/2015 Posts: 29
|
I was trying to create a sample project just to be very frustrated I was not able to recreate the issue. After a few hours of troubleshooting, I have found that the issue is resolved if I upgrade my DLLs. The issue exists in version 15.3.1, but seem to go away in version 15.3.43.0.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Ah. We did fix an issue that can cause this. Sorry that we did not suggest you to update the DLL earlier.
Please feel free to let us know if there is anything else.
|
|
Rank: Member Groups: Member
Joined: 11/13/2015 Posts: 29
|
As always. thanks for the quick response.
|
|