Browse Source

Fix #1219: v4.x: crashing on XmlBamlReader.ReadDefAttribute()

pull/1420/head
Siegfried Pammer 7 years ago
parent
commit
888d6b6088
  1. 17
      ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs

17
ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs

@ -909,11 +909,12 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
break; break;
default: default:
string recordName = stringTable[identifier]; string recordName = stringTable[identifier];
if (recordName != "Key") throw new NotSupportedException(recordName);
pd = new PropertyDeclaration(recordName, XamlTypeDeclaration); pd = new PropertyDeclaration(recordName, XamlTypeDeclaration);
if (keys == null) if (recordName == "Key") {
keys = new List<KeyMapping>(); if (keys == null)
keys.Add(new KeyMapping(text) { Position = -1 }); keys = new List<KeyMapping>();
keys.Add(new KeyMapping(text) { Position = -1 });
}
break; break;
} }
@ -1408,10 +1409,10 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
string GetTypeExtension(short typeIdentifier) string GetTypeExtension(short typeIdentifier)
{ {
string prefix = LookupPrefix(XmlToClrNamespaceMapping.XamlNamespace, false); string prefix = LookupPrefix(XmlToClrNamespaceMapping.XamlNamespace, false);
if (String.IsNullOrEmpty(prefix)) string typeName = FormatTypeDeclaration(GetTypeDeclaration(typeIdentifier));
return String.Format("{{Type {0}}}", FormatTypeDeclaration(GetTypeDeclaration(typeIdentifier))); if (string.IsNullOrEmpty(prefix))
else return string.Format("{{Type {0}}}", typeName);
return String.Format("{{{0}:Type {1}}}", prefix, FormatTypeDeclaration(GetTypeDeclaration(typeIdentifier))); return string.Format("{{{0}:Type {1}}}", prefix, typeName);
} }
string FormatTypeDeclaration(TypeDeclaration typeDeclaration) string FormatTypeDeclaration(TypeDeclaration typeDeclaration)

Loading…
Cancel
Save