Additional question - why is my static void Main(string[] args) executed twice?
When i run my app without arguments - everything is fine
When I add 1 argument (file name with some data) it starts failing
in pseudo code:
- Code: Select all
// non-working part using arguments
Console.WriteLine("arguments " + args.Length + string.Join(",", args)); // obviously my console app is executed twice?!
if (args.Length != 1)
Environment.Exit(-1); // incorrect number of arguments
// if I exit here (second time around because first time there is a single argument) my browser won't even start
The code above runs twice!? First time it prints 1 - MyFile.txt second time it prints only CEF arguments 17 - ... and original MyFile.txt is lost
NB! If I remove Exit(-1) browser runs as expected, but if I keep it browser won't start at all.
I know that my console app will start separate threads (or processes for e.g. rendering) but this time it is the other way around some (I suspect renderer) thread re-executes my code?! alas without my (original) command line parameters
- Code: Select all
CefRuntime.Load(); // the code below works as long as I do not use args[] above
//...
bool done = task.Browser.Completed.WaitOne(35000);
//...
CefRuntime.Shutdown();
NB! I'm not trying to pass arguments from the browser process to the renderer process - I am trying to read some data (JavaScript to execute after web page is loaded) from a file but something (within CefGlue) restarts my console app while dropping all command line parameters..
I stumbled upon some similar cases - all unsolved, but other people are experiencing the same
viewtopic.php?f=6&t=14360
viewtopic.php?f=14&t=14476