I have a try/catch block where I use a GetFileInfo to get the size of a specific file. I'm getting an exception shown in the output window of debugger (although the program still continues its run without reacting to the exception in any way).
The error message I get:
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
My question here is twofold:
Code:
try
{
FileInfo fileInfo = new FileInfo(filePath);
return fileInfo.Length;
}
catch
{
}
return 0;
The above code is in a method that is called and the filePath is c:\\test\\test.txt
and the file exists at that location.
\\
s in your path ;-) 在VS中,可以选择“ 调试” ->“ 异常”,并在引发特定类型的异常时关闭自动中断。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.