I have a dump of a windows service i made. The exception is that my code can't move a file (for some reason). Now, in my code there's a number of places where i move files around the filesystem. So, using Windbg, i'm trying to see the code where the exception occurs.
here's my !clrstack dump..
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
now, this helps a lot…
0:016> !do 0x0000000000d1aad0 Name: System.String MethodTable: 00000642784365e8 EEClass: 000006427803e4f0 Size: 88(0x58) bytes (C:\WINDOWS\assembly\GAC_64\mscorlib\126.96.36.199__b77a5c561934e089\mscorlib.dll) String: C:\BlahBlahFolder\FooFolder\4469.jpg Fields: -snipped-
So i've figured out the file which failed to be moved. kewl. But i just want to see the code in this method MyClass.Foo.DoSomeStuffInHere(System.String) which calls File.Move(..). That method has lots of File.Move .. so i could put try / catches / debug / trace information .. but i'm hoping to be more efficient by using Windbg to help find this problem.
You cannot get the exact line of code, unless the application was deployed in debug mode. And if that were the case, I believe it would be showing them in the !clrstack call.