I have strange trouble, I created console app App1, only purpose of this app is to get argument (val) check if this value is greater than zero if yes then run the same app (App1) with val-- in argument and turn off.
I run this app from scheduled task, I run it every one minute. The problem is that when I run this application with 1000 as argument it hangs my computer after two or three minutes (blue screen). For argument like 10 everything works fine.
I need this app to test some problem with memory management on different machine.
I runned following code:
static void Main( string[] args )
{
if ( args.Length > 0 )
{
int val = 0;
try
{
Int32.TryParse( args[ 0 ], out val );
}
catch ( Exception ex )
{ }
if ( val > 0 )
{
val--;
ProcessStartInfo psi = new ProcessStartInfo(System.Windows.Forms.Application.ExecutablePath, val.ToString() );
psi.CreateNoWindow = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start( psi );
}
System.Console.WriteLine( args[ 0 ] );
}
System.Console.WriteLine( "App" );
}