Bug in assembly resource decompilation
FbSoft
Posts: 1 New member
Hi,
I upgraded Net Reflector to version 11.1 from version 10.3.
When I try to open an localized assmbly resource like System.Web.Mvc.resources.dll clicking on assemIy node I obtain the following error:
Translation failure in 'System.Web.Mvc.resources, Version=5.2.7.0, Culture=de, PublicKeyToken=31bf3856ad364e35' in 'System.Web.Mvc.resources, Version=5.2.7.0, Culture=de, PublicKeyToken=31bf3856ad364e35'.
System.Reflection.TargetInvocationException
Caused by:
Unable to get assembly reference for type of code identifier.
System.NotSupportedException
in Reflector.ObjectModelResolutionHelper.GetAssemblyReference(ITypeReference value)
in Reflector.CodeIdentifier.SetTypeDeclaration(IType type)
in Reflector.CodeIdentifier..ctor(Object value)
in Reflector.Application.UserInterface.HtmlFormatterViewer.GenerateLinkUrl(Object value)
in Reflector.Application.UserInterface.HtmlFormatterViewer.WriteReference(String text, String toolTip, Object target)
in Reflector.Application.Languages.CSharpLanguage.LanguageWriter.WriteCustomAttribute(ICustomAttribute customAttribute, IFormatter formatter)
in Reflector.Application.Languages.CSharpLanguage.LanguageWriter.WriteCustomAttributeList(ICustomAttributeProvider value, IFormatter formatter, String target, HashSet`1 hide)
in Reflector.Application.Languages.CSharpLanguage.LanguageWriter.WriteAssembly(IAssembly value)
in Reflector.Application.UserInterface.DisassemblerWindow.Render(Boolean expandTypes, Boolean expandMethods)
System.Reflection.TargetInvocationException
Caused by:
Unable to get assembly reference for type of code identifier.
System.NotSupportedException
in Reflector.ObjectModelResolutionHelper.GetAssemblyReference(ITypeReference value)
in Reflector.CodeIdentifier.SetTypeDeclaration(IType type)
in Reflector.CodeIdentifier..ctor(Object value)
in Reflector.Application.UserInterface.HtmlFormatterViewer.GenerateLinkUrl(Object value)
in Reflector.Application.UserInterface.HtmlFormatterViewer.WriteReference(String text, String toolTip, Object target)
in Reflector.Application.Languages.CSharpLanguage.LanguageWriter.WriteCustomAttribute(ICustomAttribute customAttribute, IFormatter formatter)
in Reflector.Application.Languages.CSharpLanguage.LanguageWriter.WriteCustomAttributeList(ICustomAttributeProvider value, IFormatter formatter, String target, HashSet`1 hide)
in Reflector.Application.Languages.CSharpLanguage.LanguageWriter.WriteAssembly(IAssembly value)
in Reflector.Application.UserInterface.DisassemblerWindow.Render(Boolean expandTypes, Boolean expandMethods)
Conversely using the older version 10.3 the assembly is loaded correctly.
Thanks
Filippo
Tagged:
Answers
It seems like version 11.1.0.2167 of Reflector has a critical bug that prevents decompiling assemblies with generics. The issue results in errors, including
System.NotSupportedException: Malformed function pointer signature
. After updating to the latest Visual Studio 2022 service pack, this version becomes unusable for most DLLs.For now, I recommend switching to JetBrains dotPeek, which is more reliable. Here's an example of the error encountered with Reflector:
dotPeek should provide a better decompiling experience until Reflector gets patched.
It seems you're encountering a bug related to assembly resource decompilation. Assembly decompilation typically refers to the process of converting compiled machine code or assembly language back into a higher-level source code. Here are some common issues and potential causes for bugs during this process:
Possible Causes:
Incorrect Handling of Data Sections: Assembly programs consist of code and data sections, and decompilers might struggle with distinguishing between them. If the data section is misinterpreted as code or vice versa, it can lead to incorrect decompilation.
Optimizations During Compilation: Compiler optimizations can result in code that's harder to decompile. This includes things like inlining functions, loop unrolling, or register renaming. The decompiler might fail to correctly reconstruct the original high-level structure.
Missing or Inaccurate Debug Information: If the assembly code lacks debug symbols or proper annotations, the decompiler can misinterpret or fail to fully reconstruct the high-level source code.
Control Flow Issues: The decompiler might have issues reconstructing control flow, especially if the program uses low-level tricks like self-modifying code, indirect jumps, or obfuscation.
Unsupported Instruction Set: If the assembly uses a specific processor instruction set that's not well-supported by the decompiler, it may result in errors or incomplete decompilation.
Inaccurate Stack Handling: A decompiler might have trouble dealing with complex stack manipulations, such as those used in recursive function calls, indirect addressing, or register spills.
Corrupted Input Files: If the assembly file itself is corrupted or improperly formatted, this can introduce bugs during decompilation.
Compatibility Issues: Sometimes the decompiler might not support the specific version of the binary or assembly code you're working with.
Steps to Debug:
Check Input Format: Ensure that the assembly or binary you're working with is in a format that the decompiler supports (e.g., ELF, PE, Mach-O).
Use Another Decompiler: If one tool is failing, try using a different assembly decompiler, such as IDA Pro, Ghidra, or Radare2. Different tools handle assembly differently.
Examine Control Flow: Look at the control flow in the disassembled assembly to see if any jumps, calls, or branches are misrepresented.
Check for Obfuscation: If the code is obfuscated, you might need to use specific deobfuscation techniques or tools to get better results.
Debug with Debug Information: If possible, obtain debug symbols or source maps for the assembly to aid the decompiler in correctly identifying function boundaries and variable names.
Test with a Small Example: Test the decompiler on a simpler assembly file to check if the issue is with the specific binary or the tool itself.
Common Decompilers:
If you have more specific details about the bug or error message, feel free to share them, and I can offer more targeted advice.
It seems you're facing a decompilation bug due to various potential causes like incorrect data handling, optimization issues, or missing debug information. Try using a different decompiler, checking for obfuscation, or ensuring the file format is compatible for more accurate results.