C# 开发中的调试与应用实践
1. 调试基础与异常处理
在 C# 开发过程中,调试是解决程序问题的重要手段。当遇到未处理的异常时,如 System.IO.FileNotFoundException
,会出现相应的异常信息。例如:
System.IO.FileNotFoundException was unhandled
Message=Could not find file 'C:\DoesNotExit.txt'.
Source=mscorlib
FileName=C:\DoesNotExit.txt
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access,
Int32
rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions
options,
SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean
useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess acces