Error UnathorizedException when invoking JavaScript from C# -


i trying call javascript code c# in phonegap (cordova) windows phone 8 application. following steps of accepted answer thread: how call javascript c# - cordova/phonegap

i supposed able access method in javascript part or execute hardcoded js code. but, encountering error:

an exception of type 'system.io.filenotfoundexception' occurred in mscorlib.ni.dll , wasn't handled before managed/native boundary
first chance exception of type 'system.unauthorizedaccessexception' occurred in system.windows.ni.dll
exception of type 'system.unauthorizedaccessexception' occurred in system.windows.ni.dll not handled in user code
first chance exception of type 'system.reflection.targetinvocationexception' occurred in mscorlib.ni.dll
exception of type 'system.reflection.targetinvocationexception' occurred in mscorlib.ni.dll , wasn't handled before managed/native boundary
error: exception in processcommand :: exception has been thrown target of invocation.
error: failed invokemethodnamed :: pluginmethod on object :: example

my code (is native plugin):

namespace wpcordovaclasslib.cordova.commands {     public class example : cordova.commands.basecommand     {         public void pluginmethod(string options)         {           //the error caused in line           pgwebbrowserhandler.getinstance().webview.cordovabrowser               .invokescript("eval",                              new string[] { "alert('is running?!');" });         }     } } 

pgwebbrowserhandler name of singleton class given in previous mentioned thread in order have access cordovabrowser c# class.

the error (filenotfoundexception, unauthorizedaccessexception , targetinvocationexception) not caused invokescript() method, caused obtaining webview, doesn't crash debugging it, lot of methods causing unauthorizedaccessexception.

i hope explanations clear. i've been searching in google i've not found solution or workaround anywhere. know reason of these problems? invoking invokescript() method mainpage.cs cause exceptions.

try code:

dispatcher.begininvoke(             () =>             {                 pgwebbrowserhandler.getinstance().webview.cordovabrowser                     .invokescript("eval",                       new string[] { "alert('is running?!');" });             }); 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -