我有一个我制作的 Windows 服务的转储。例外是我的代码无法移动文件(出于某种原因)。现在,在我的代码中有很多地方可以在文件系统中移动文件。因此,使用 Windbg,我试图查看发生异常的代码。
这是我的 !clrstack 转储..
0:016> !clrstack -p
OS Thread Id: 0xdf8 (16)
Child-SP RetAddr Call Site
0000000019edea70 0000064278a15e4f System.IO.__Error.WinIOError(Int32, System.String)
PARAMETERS:
errorCode = <no data>
maybeFullPath = <no data>
0000000019edead0 0000064280181ce5 System.IO.File.Move(System.String, System.String)
PARAMETERS:
sourceFileName = <no data>
destFileName = <no data>
0000000019edeb50 0000064280196532 MyClass.Foo.DoSomeStuffInHere(System.String)
PARAMETERS:
this = 0x0000000000c30aa8
filePathAndName = 0x0000000000d1aad0
现在,这有很大帮助...
0:016> !do 0x0000000000d1aad0
Name: System.String
MethodTable: 00000642784365e8
EEClass: 000006427803e4f0
Size: 88(0x58) bytes
(C:\WINDOWS\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)
String: C:\BlahBlahFolder\FooFolder\4469.jpg
Fields:
-snipped-
所以我找出了无法移动的文件。科尔。但我只想查看调用 File.Move(..) 的 MyClass.Foo.DoSomeStuffInHere(System.String) 方法中的代码。该方法有很多 File.Move .. 所以我可以放 try / catches / debug / trace 信息.. 但我希望通过使用 Windbg 来帮助找到这个问题来提高效率。
有什么想法吗?