I was just wondering if it will be possible in the near future to debug .net 4.0 binaries. At the moment, dile 0.2.7 will output the error
Exception occurred while loading the assembly: System.Runtime.InteropServices.COMException (0x80131700): Failed to load the runtime. (Exception from HRESULT: 0x80131700)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Dile.Debug.MetaHost.GetRuntime(String frameworkVersion)
at Dile.UI.MainForm.RunDebuggee()
The required Framework (4.0) is installed ofc. Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, it's definitely not an "anti-debug" trick. There are no such tricks in DILE. It rather seems to be a bug.
DILE does support .NET 4.0 and the best proof of this is that you can debug DILE with DILE. However, seems like in your case DILE determines the version of the .NET Framework that is required by the debuggee incorrectly. Are you changing the debuggee's required .NET FW version in the app.config file perhaps?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
the target runtime version is: // Target Runtime Version: v4.0.20926
Another interesting fact is that the application is not listed in the list of active processes in dile's attach to process dialog. I did not mess with anything of the application. (It's compiled software of a company my company probably will buy :X)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Seems like v4.0.20926 was some kind of internal release of .NET Framework 4.0 between Beta 1 and Beta 2. At least, that's what I found in a blog entry. Released .NET Framework's version number is 4.0.30319.
My questions are:
1. Does your application have anything to do with ILMerge? Seems like there was a version of ILMerge that produced assemblies which targeted v4.0.20926.
2. Are you sure that the application is compiled against the RTM version of .NET 4.0?
3. Do you have v4.0.20926 installed on your machine or are you trying to run the application against the RTM version?
Btw, this framework difference would also explain why the application doesn't appear in the attach to process dialog.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately testing DILE is not an easy task so in cases where I wasn't not sure of how to handle a situation, I just throw a NotImplementedException. You just found such a place.
I've looked at the source code and seems like I didn't quite know how ansi BSTRs are expressed in IL.
Could you please do me a favor and send me the code that ildasm gives you for that method? It would be a great help and I think I'll be able to fix DILE based on that.
My e-mail address is: dile.project@gmail.com.
Thank you in advance.
Regards,
Zsolt Petreny
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the mail, I found the problem and quickly fixed it. Try the latest weekly builds (v0.2.7.2520) that I've just uploaded and let me know if you still have that problem or any other. Once again, thanks for the bug report and the help.
Regards,
Zsolt Petreny
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Now DILE can load the assembly that i sent you , but with few loading attempt.
If you look at the "Information" window , there is more problems . It will be nice if you fix them too.
\w*******.exe: Reading header… (elapsed time = 00:00:00.0043610)
\w.exe: Opening assembly references…
Exception occurred while loading the assembly: System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.Combine(String path1, String path2)
at Dile.Disassemble.Assembly.OpenAssemblyRefs()
at Dile.Disassemble.Assembly.LoadAssemblyFromMetadataInterfaces(ModuleWrapper debuggedModule)
at Dile.Disassemble.Assembly.LoadAssembly()
at Dile.UI.AssemblyLoader.LoadAssembly(String filePath)
at Dile.UI.AssemblyLoader.Start(Object parameter) (elapsed time = 00:00:00.2752005)
Infragistics2.Win.v9.1.dll: Loading module scope…
Exception occurred while loading the assembly: System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.GetDirectoryName(String path)
at Dile.Disassemble.Assembly.OpenAssemblyRefs()
at Dile.Disassemble.Assembly.LoadAssemblyFromMetadataInterfaces(ModuleWrapper debuggedModule)
at Dile.Disassemble.Assembly.LoadAssembly()
at Dile.UI.AssemblyLoader.LoadAssembly(String filePath)
at Dile.UI.AssemblyLoader.Start(Object parameter) (elapsed time = 00:00:00.0116103)
Creating text representation of the object…
Exception occurred while loading the assembly: System.NotImplementedException: Two try expressions were found at the same IL offset with different lengths.
at Dile.Disassemble.MethodDefinition.ReadMethodDataSections(BinaryReader assemblyReader)
at Dile.Disassemble.MethodDefinition.ReadILCode()
at Dile.Disassemble.MethodDefinition.Initialize()
at Dile.UI.CodeDisplayer.ShowCodeObject(CodeObjectDisplayOptions options) C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Reading header… (elapsed time = 00:00:00.0012533)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Opening assembly references… (elapsed time = 00:00:00.0439706)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading user strings… (elapsed time = 00:00:00.0046378)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading manifest resources… (elapsed time = 00:00:00.0004469)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading files… (elapsed time = 00:00:00.0004368)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading module references… (elapsed time = 00:00:00.0006849)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading type references… (elapsed time = 00:00:00.3679548)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading global type's references… (elapsed time = 00:00:00.0005745)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading type specifications… (elapsed time = 00:00:00.0293313)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading exported types… (elapsed time = 00:00:00.0004554)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading standalone signatures… (elapsed time = 00:00:00.0004441)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading module scope… (elapsed time = 00:00:03.5557870)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading global type… (elapsed time = 00:00:00.0012161)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Associating properties with methods… (elapsed time = 00:00:00.0008309)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Reading assembly properties… (elapsed time = 00:00:00.0008718)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading resolving resolution scopes… (elapsed time = 00:00:00.0009511)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Searching for entry method… (elapsed time = 00:00:00.0008018)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks a lot for the bug reports. Unfortunately I was quite busy in the weekend and I haven't fixed these bugs yet but I'll try to do it next week as soon as I can.
In the meantime, if you find any other bugs then please do let me know.
Regards,
Zsolt Petreny
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry because it took me so long but I think all the bugs that you mentioned are fixed.
I think the first and the second bugs are the same. I haven't been able to reproduce these but I can guess what's going on. During assembly loading DILE tries to figure out where referenced assemblies are and seems like this fails because your assembly is in a folder that somehow .NET considers invalid. I guess there are a few "funny" characters in the path or something. I think this bug is fixed now (all such exceptions are ignored, that's the best I could do) but if you still have problems with it then maybe just move your assemblies to another folder with simpler path.
The third bug was really a bug. That's fixed now. DILE had a little problem with disassembling methods with try-filter-catch structures…
And I found a 4th bug as well. Seems like obfuscation can somehow hide/remove information about parameters and that's something that DILE didn't expect. Now DILE will give a warning whenever it has to disassemble such a method and it will replace proper parameter names with A_0, A_1..A_N.
So, please give the latest version of DILE a try (v0.2.7.2530) and let me know whether it works for you.
Regards,
Zsolt Petreny
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there,
I was just wondering if it will be possible in the near future to debug .net 4.0 binaries. At the moment, dile 0.2.7 will output the error
Exception occurred while loading the assembly: System.Runtime.InteropServices.COMException (0x80131700): Failed to load the runtime. (Exception from HRESULT: 0x80131700)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Dile.Debug.MetaHost.GetRuntime(String frameworkVersion)
at Dile.UI.MainForm.RunDebuggee()
The required Framework (4.0) is installed ofc. Regards
Update on this one: I tried to debug a .net4.0 binary I created by myself, works fine. Is this kind of an anti-debug trick?
Sorry for the late reply.
No, it's definitely not an "anti-debug" trick. There are no such tricks in DILE. It rather seems to be a bug.
DILE does support .NET 4.0 and the best proof of this is that you can debug DILE with DILE. However, seems like in your case DILE determines the version of the .NET Framework that is required by the debuggee incorrectly. Are you changing the debuggee's required .NET FW version in the app.config file perhaps?
Hi again,
the target runtime version is: // Target Runtime Version: v4.0.20926
Another interesting fact is that the application is not listed in the list of active processes in dile's attach to process dialog. I did not mess with anything of the application. (It's compiled software of a company my company probably will buy :X)
Ok, it's getting more interesting. :)
Seems like v4.0.20926 was some kind of internal release of .NET Framework 4.0 between Beta 1 and Beta 2. At least, that's what I found in a blog entry. Released .NET Framework's version number is 4.0.30319.
My questions are:
1. Does your application have anything to do with ILMerge? Seems like there was a version of ILMerge that produced assemblies which targeted v4.0.20926.
2. Are you sure that the application is compiled against the RTM version of .NET 4.0?
3. Do you have v4.0.20926 installed on your machine or are you trying to run the application against the RTM version?
Btw, this framework difference would also explain why the application doesn't appear in the attach to process dialog.
@zerojump
Simple change version number into 4.0.30319 with CFF Explorer , then debug with DILE 2.7 :) .
Hi zsozsop
What about this one ?
Hi jonny117,
Unfortunately testing DILE is not an easy task so in cases where I wasn't not sure of how to handle a situation, I just throw a NotImplementedException. You just found such a place.
I've looked at the source code and seems like I didn't quite know how ansi BSTRs are expressed in IL.
Could you please do me a favor and send me the code that ildasm gives you for that method? It would be a great help and I think I'll be able to fix DILE based on that.
My e-mail address is: dile.project@gmail.com.
Thank you in advance.
Regards,
Zsolt Petreny
I've sent a few mail.
I've sent a mail.
Hi jonny 177,
Thanks for the mail, I found the problem and quickly fixed it. Try the latest weekly builds (v0.2.7.2520) that I've just uploaded and let me know if you still have that problem or any other. Once again, thanks for the bug report and the help.
Regards,
Zsolt Petreny
Thanks for the fix , Zsolt Petreny.
Now DILE can load the assembly that i sent you , but with few loading attempt.
If you look at the "Information" window , there is more problems . It will be nice if you fix them too.
Infragistics2.Win.v9.1.dll: Loading module scope…
Exception occurred while loading the assembly: System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.GetDirectoryName(String path)
at Dile.Disassemble.Assembly.OpenAssemblyRefs()
at Dile.Disassemble.Assembly.LoadAssemblyFromMetadataInterfaces(ModuleWrapper debuggedModule)
at Dile.Disassemble.Assembly.LoadAssembly()
at Dile.UI.AssemblyLoader.LoadAssembly(String filePath)
at Dile.UI.AssemblyLoader.Start(Object parameter) (elapsed time = 00:00:00.0116103)
Creating text representation of the object…
Exception occurred while loading the assembly: System.NotImplementedException: Two try expressions were found at the same IL offset with different lengths.
at Dile.Disassemble.MethodDefinition.ReadMethodDataSections(BinaryReader assemblyReader)
at Dile.Disassemble.MethodDefinition.ReadILCode()
at Dile.Disassemble.MethodDefinition.Initialize()
at Dile.UI.CodeDisplayer.ShowCodeObject(CodeObjectDisplayOptions options) C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Reading header… (elapsed time = 00:00:00.0012533)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Opening assembly references… (elapsed time = 00:00:00.0439706)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading user strings… (elapsed time = 00:00:00.0046378)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading manifest resources… (elapsed time = 00:00:00.0004469)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading files… (elapsed time = 00:00:00.0004368)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading module references… (elapsed time = 00:00:00.0006849)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading type references… (elapsed time = 00:00:00.3679548)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading global type's references… (elapsed time = 00:00:00.0005745)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading type specifications… (elapsed time = 00:00:00.0293313)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading exported types… (elapsed time = 00:00:00.0004554)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading standalone signatures… (elapsed time = 00:00:00.0004441)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading module scope… (elapsed time = 00:00:03.5557870)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading global type… (elapsed time = 00:00:00.0012161)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Associating properties with methods… (elapsed time = 00:00:00.0008309)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Reading assembly properties… (elapsed time = 00:00:00.0008718)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Loading resolving resolution scopes… (elapsed time = 00:00:00.0009511)
C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll: Searching for entry method… (elapsed time = 00:00:00.0008018)
Hi jonny117,
Thanks a lot for the bug reports. Unfortunately I was quite busy in the weekend and I haven't fixed these bugs yet but I'll try to do it next week as soon as I can.
In the meantime, if you find any other bugs then please do let me know.
Regards,
Zsolt Petreny
Hi jonny117,
Sorry because it took me so long but I think all the bugs that you mentioned are fixed.
I think the first and the second bugs are the same. I haven't been able to reproduce these but I can guess what's going on. During assembly loading DILE tries to figure out where referenced assemblies are and seems like this fails because your assembly is in a folder that somehow .NET considers invalid. I guess there are a few "funny" characters in the path or something. I think this bug is fixed now (all such exceptions are ignored, that's the best I could do) but if you still have problems with it then maybe just move your assemblies to another folder with simpler path.
The third bug was really a bug. That's fixed now. DILE had a little problem with disassembling methods with try-filter-catch structures…
And I found a 4th bug as well. Seems like obfuscation can somehow hide/remove information about parameters and that's something that DILE didn't expect. Now DILE will give a warning whenever it has to disassemble such a method and it will replace proper parameter names with A_0, A_1..A_N.
So, please give the latest version of DILE a try (v0.2.7.2530) and let me know whether it works for you.
Regards,
Zsolt Petreny
Thank you very much for the fixes , Zsolt Petreny.
Now i don't see any errors in information window and all assemblies are imported properly with first attempt :) . Great !
BTW , I decided to post a bugs in new thread .
Regards