Welcome Guest Search | Active Topics | Sign In | Register

NavigationTask.WaitOne does not release Options
Roei Ben-Harush
Posted: Thursday, December 17, 2015 2:44:05 PM
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?
eo_support
Posted: Thursday, December 17, 2015 8:48:04 PM
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!
Roei Ben-Harush
Posted: Thursday, December 17, 2015 9:56:06 PM
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.
eo_support
Posted: Friday, December 18, 2015 6:53:24 AM
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.aspx

Thanks!
Roei Ben-Harush
Posted: Friday, December 18, 2015 1:45:00 PM
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.
eo_support
Posted: Friday, December 18, 2015 2:29:50 PM
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.
Roei Ben-Harush
Posted: Friday, December 18, 2015 2:48:51 PM
Rank: Member
Groups: Member

Joined: 11/13/2015
Posts: 29
As always. thanks for the quick response.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.