Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

QueueScriptCall not completed.... Options
Swatchqaws
Posted: Wednesday, June 14, 2017 10:28:01 PM
Rank: Newbie
Groups: Member

Joined: 10/3/2016
Posts: 3
Hi EO,

We used EO version is 17.0.81.0.

There is a strange problem, the application should stop at the following call in EO browser.

This is how we call javascript function from dot NET,

Code: C#
public void InvokeJS(string script)
        {
           Console.WriteLine("@@@@ Start @@@@");
            try
            {
		Console.WriteLine("Script : " + script);
                var scriptCall = new ScriptCall(script);
                var call = _browser?.QueueScriptCall(scriptCall);
                call?.OnDone(() =>
                {
                    if (call.Exception != null)
                    {
                        string sTemp = "";
                        sTemp = call.Exception.Message;
                        throw new Exception("QueueScriptCall Err :  " + sTemp);
                    }    
                });
                call.WaitOne();
            }

            catch (Exception ex)
            {
               Console.WriteLine("An error has occurred: " + ex.ToString());
            }
            finally
            {
               Console.WriteLine("@@@@ End @@@@");
            }
        }


Log as below :

@@@@ Start @@@@
Script : ShowUser('A0','F1','GOODUSER') <= Stop in here all day all night.




Without any try catch error message, look like while loop or deadlock at QueueScriptCall() or call.WaitOne().

Is this a known issue?

Is there any error in my C# code or miss understanding EO function?

Thanks.

Best Regards,

Swatchqaws



Hi EO,

Other problems happen, log as below:

@@@@ Start @@@@
Script : RESFuncPay('ACC1315')
@@@@ End @@@@
Runtime_Exception Message: QueueScriptCall Time Out EvalScript failed because The WebView has been destroyed.
Runtime_Exception Source: EOContainer
Runtime_Exception InnerException:

Strange, I'm not destroyed EO in code. whether the QueueScriptCall() time out will cause crashed in EO.

Would you please help me to deal with / to clarify those problems and avoid happen again.

System information:

OS Win7 Professional 32 bit sp1,
Memory 4G
Platform: Winform

Thank you very much.

Best Regards,

Swatchqaws


eo_support
Posted: Thursday, June 15, 2017 8:46:48 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 19,333
Hi,

Please remove call.WaitOne. The idea of QueueScript is so that you do NOT wait so that the browser engine can continue with what is was doing, and once that is done, it will run your JavaScript. So if you wait then the browser engine can not continue to run your JavaScript, which will cause a deadlock for you. The key is you have to allow the browser engine to finish what it was doing first.

Thanks!
Swatchqaws
Posted: Thursday, June 15, 2017 10:54:07 AM
Rank: Newbie
Groups: Member

Joined: 10/3/2016
Posts: 3
Hi EO,

Thank you quick reply. I will modify our code to below version for test.
Code: C#
public void InvokeJS(string script)
        {
           Console.WriteLine("@@@@ Start @@@@");
            try
            {
		Console.WriteLine("Script : " + script);
                var scriptCall = new ScriptCall(script);
                _browser?.QueueScriptCall(scriptCall);
            }

            catch (Exception ex)
            {
               Console.WriteLine("An error has occurred: " + ex.ToString());
            }
            finally
            {
               Console.WriteLine("@@@@ End @@@@");
            }
        }


Code: C#
_browser.ScriptCallDone += _browser_ScriptCallDone;

 private void _browser_ScriptCallDone(object sender, ScriptCallDoneEventArgs e)
        {
            Console.WriteLine("Queue Script Call IsDone : " + e.Call.IsDone + " ,IsAborted : " + e.Call.IsAborted);
            if (e.Call.Exception != null)
                 Console.WriteLine("Queue Script Call Exception [" + e.Call.Exception + "]");
        }


Hope this modify will solve those problems.

Other question, whether QueueScriptCall() method will return the ScriptCallDone event every time regardless executed of success or failure?

Thanks a lot .

Swatchqaws
eo_support
Posted: Thursday, June 15, 2017 1:40:22 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 19,333
Hi,

Yes. ScriptCallDone event will be called for every ScriptCall object submitted through QueueScriptCall regardless success or failure.

Thanks!


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.