You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first of all thanks for the great work you are doing with ILSpy: I really love it.
I have found a bug with the baml decompiler (even with the current stable version of ILSpy - 2.1.0.1603), which happens whenever you try to decompile some baml (more specifically, the ones contained within some of the Visual Studio 2010 internal dlls).
Here is the full stack trace for the exception:
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Byte.Parse(String s, NumberStyles style, NumberFormatInfo info)
at Mono.Cecil.AssemblyNameReference.Parse(String fullName)
at ILSpy.BamlDecompiler.CecilTypeResolver.GetTypeByAssemblyQualifiedName(String name)
at Ricciolo.StylesExplorer.MarkupReflection.TypeDeclaration.get_Type()
at Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.get_NamespaceURI()
at Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.get_Prefix()
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at ILSpy.BamlDecompiler.BamlResourceEntryNode.LoadIntoDocument(IAssemblyResolver resolver, AssemblyDefinition asm, Stream stream)
at ILSpy.BamlDecompiler.BamlResourceEntryNode.LoadBaml(AvalonEditTextOutput output)
at ILSpy.BamlDecompiler.BamlResourceEntryNode.<>c__DisplayClass3.b__1()
Perhaps CecilTypeResolver should react silently to the exception and try to decompile with the information it already has?
Thanks a lot for your support.
Cheers
The text was updated successfully, but these errors were encountered:
I can provide more information as I just received a detailed report for Obfuscar. A patch is required to fix this issue. I might send a pull request soon,
diff --git a/ILSpy.BamlDecompiler/CecilTypeResolver.cs b/ILSpy.BamlDecompiler/CecilTypeResolver.cs
index 9768472..b6d1320 100644
--- a/ILSpy.BamlDecompiler/CecilTypeResolver.cs
+++ b/ILSpy.BamlDecompiler/CecilTypeResolver.cs
@@ -37,7 +37,13 @@ namespace ILSpy.BamlDecompiler
public IType GetTypeByAssemblyQualifiedName(string name)
{
- int comma = name.IndexOf(',');
+ int bracket = name.LastIndexOf(']');
+ int comma = bracket > -1 ? name.IndexOf(',', bracket) : name.IndexOf(',');
if (comma == -1)
throw new ArgumentException("invalid name");
The cause is that for generics types, the name can be very complex, such as
Hello,
first of all thanks for the great work you are doing with ILSpy: I really love it.
I have found a bug with the baml decompiler (even with the current stable version of ILSpy - 2.1.0.1603), which happens whenever you try to decompile some baml (more specifically, the ones contained within some of the Visual Studio 2010 internal dlls).
Here is the full stack trace for the exception:
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Byte.Parse(String s, NumberStyles style, NumberFormatInfo info)
at Mono.Cecil.AssemblyNameReference.Parse(String fullName)
at ILSpy.BamlDecompiler.CecilTypeResolver.GetTypeByAssemblyQualifiedName(String name)
at Ricciolo.StylesExplorer.MarkupReflection.TypeDeclaration.get_Type()
at Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.get_NamespaceURI()
at Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.get_Prefix()
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at ILSpy.BamlDecompiler.BamlResourceEntryNode.LoadIntoDocument(IAssemblyResolver resolver, AssemblyDefinition asm, Stream stream)
at ILSpy.BamlDecompiler.BamlResourceEntryNode.LoadBaml(AvalonEditTextOutput output)
at ILSpy.BamlDecompiler.BamlResourceEntryNode.<>c__DisplayClass3.b__1()
Perhaps CecilTypeResolver should react silently to the exception and try to decompile with the information it already has?
Thanks a lot for your support.
Cheers
The text was updated successfully, but these errors were encountered: