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: 5
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: 24,225
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: 5
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: 24,225
Hi,

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

Thanks!
Swatchqaws
Posted: Monday, September 4, 2017 6:46:43 AM
Rank: Newbie
Groups: Member

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

Base on above code the webview will encounter that it calls QueueScriptCall function after then the ScriptCallDone event not trigger.

And wait for a while, the RenderUnresponsive event have been trigged without any useful information at event parameter RenderUnresponsiveEventArgs.( I mean it return a null)

How to prevent this situation?

Whether or not I have to do a QueueScriptCall queue? if QueueScriptCall not completed I will not trigger other QueueScriptCall?

Please help me to solve this problem, thank you very much.

Best,

Swatchqaws
eo_support
Posted: Monday, September 4, 2017 11:27:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,225
Hi,

RenderUnresponsive usually indicates a problem in your JavaScript code and there is no magic bullet to fix this situation --- the only real solution to fix such issue is to fix the JavaScript code that causes the problem. For example, if you try to run an infinite loop in your JavaScript code, then you will get RenderUnresponsive, and the only way to fix this problem is for you to fix the infinite loop issue. The only other option you have beside fixing the JavaScript code is to kill the WebView, this is in fact why RenderUnresponsive exists --- it offers you (or the user) a chance to stop waiting and kill the WebView.

Thanks!
Swatchqaws
Posted: Monday, September 4, 2017 10:53:13 PM
Rank: Newbie
Groups: Member

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

Thank you for your response. The javascript code normally works fine on the web page most of the time. But some situation encountered this problem at the same javascript code. I have no idea how to resolve this problem.
Would you please give me other probable direction I will try to insert log in javascript to find this issue solution...

Thanks!

Swatchqaws
eo_support
Posted: Tuesday, September 5, 2017 8:27:14 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,225
Hi,

No. There are no band-aid solutions. You need to fix the root of the problem in order to resolve such issues.

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.