H
HeshamVoda
Guest
I am running a c# program through task scheduler, The program reads some files in a directory and writes files in another directory. I created a batch file to run the program and close it. The task scheduler reads the path of the batch file and runs. It was running since i created it but then suddenly crashed with the following Error in Event Viewer:
Fault bucket 432971663, type 30 Event Name: CLR20r3 Response: Not available Cab Id: 0
Problem signature: P1: windowsapplication1.exe P2: 1.0.0.0 P3: 582dbf22 P4: mscorlib P5: 4.0.30319.18408 P6: 52310544 P7: 4427 P8: 9a P9: System.IO.IOException P10:
Attached files:
C:\Users\brstft\AppData\Local\Temp\WER1E4.tmp.appcompat.txt
C:\Users\brstft\AppData\Local\Temp\WER224.tmp.WERInternalMetadata.xml
C:\Users\brstft\AppData\Local\Temp\WER244.tmp.hdmp
C:\Users\brstft\AppData\Local\Temp\WERACD.tmp.mdmp
What i tried is to use try and catch in my main method. IF the solution is with the Application.SetUnhandledExceptionMode and AppDomain.UnhandledException. How can i implement this syntax wise in my program, I also made sure that the same .NET Version exists on both the computer i made the program on and on the pc where i am running the program from. I cleared the temp file. I know that there are similar question, but there is no specific solution to the .IO Exception. Any help will be very appreciated. Thanks in Advance
Here is the Code:
static void OnCreated()
{
try
{
List<string> todayFiles = Directory.GetFiles(@"\\ a \b \c\").Where(x => new FileInfo(x).LastWriteTime.Date == DateTime.Today.Date).ToList();
todayFiles.ForEach(Console.WriteLine);
foreach (var file in todayFiles)
{
// e.FullPath.Equals(file.ToString());
var fileName = file;
var Name_File = Path.GetFileName(fileName);
var tempfilepath = (@"P:\a\" + Name_File + ".CSV");
ReadData(tempfilepath, fileName);
Thread.Sleep(4000);
File.Move(@"\\a\b\c\" + Name_File, @"P:\a\" + Name_File);
}
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
}
Continue reading...
Fault bucket 432971663, type 30 Event Name: CLR20r3 Response: Not available Cab Id: 0
Problem signature: P1: windowsapplication1.exe P2: 1.0.0.0 P3: 582dbf22 P4: mscorlib P5: 4.0.30319.18408 P6: 52310544 P7: 4427 P8: 9a P9: System.IO.IOException P10:
Attached files:
C:\Users\brstft\AppData\Local\Temp\WER1E4.tmp.appcompat.txt
C:\Users\brstft\AppData\Local\Temp\WER224.tmp.WERInternalMetadata.xml
C:\Users\brstft\AppData\Local\Temp\WER244.tmp.hdmp
C:\Users\brstft\AppData\Local\Temp\WERACD.tmp.mdmp
What i tried is to use try and catch in my main method. IF the solution is with the Application.SetUnhandledExceptionMode and AppDomain.UnhandledException. How can i implement this syntax wise in my program, I also made sure that the same .NET Version exists on both the computer i made the program on and on the pc where i am running the program from. I cleared the temp file. I know that there are similar question, but there is no specific solution to the .IO Exception. Any help will be very appreciated. Thanks in Advance
Here is the Code:
static void OnCreated()
{
try
{
List<string> todayFiles = Directory.GetFiles(@"\\ a \b \c\").Where(x => new FileInfo(x).LastWriteTime.Date == DateTime.Today.Date).ToList();
todayFiles.ForEach(Console.WriteLine);
foreach (var file in todayFiles)
{
// e.FullPath.Equals(file.ToString());
var fileName = file;
var Name_File = Path.GetFileName(fileName);
var tempfilepath = (@"P:\a\" + Name_File + ".CSV");
ReadData(tempfilepath, fileName);
Thread.Sleep(4000);
File.Move(@"\\a\b\c\" + Name_File, @"P:\a\" + Name_File);
}
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
}
Continue reading...