Convert class throws exception

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My C# console application takes 5 parameters two of which are supposed to be inherently integers

So I do COnvert.ToInt32(args[3])
There is no problem with the console application when I run it at the command prompt

But the above statement raises an exception when I use CreateProcess(NULL,CommandLin
....) from a C++ code

I have the c# code compiled with /unsafe option

What is the workaround to this problem with Convert class

thank yo
vipin
 
vipin said:
My C# console application takes 5 parameters two of which are
supposed to be inherently integers.

So I do COnvert.ToInt32(args[3]).
There is no problem with the console application when I run it at the
command prompt.

But the above statement raises an exception when I use
CreateProcess(NULL,CommandLine
...) from a C++ code.


I have the c# code compiled with /unsafe option.

What is the workaround to this problem with Convert class?

My guess is that's it's actually not a problem with the Convert class
at all, but with the parameter that you're passing in.

I suggest you get the C# program to print out what args[3] is before
trying to convert it, so you can see what's likely to be wrong.
 
Back
Top