I have a strange problem, I created the console application App1, only the purpose of this application is to get the argument (val), if this value is greater than zero, if so, then run the same application (App1) with the argument val-- in the argument and turn off .
I launch this application from a scheduled task, I launch it every minute. The problem is that when I run this application with 1000 as an argument, it hangs on my computer after two or three minutes (blue screen). For an argument like 10, everything works fine.
I need this application to check some memory management problems on another machine.
I ran the 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" ); }
source share