Skip to content
Permalink
Browse files

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

  • Loading branch information...
siegfriedpammer committed Jul 20, 2018
1 parent 71ffb01 commit 888d6b6088d34f64f9b3b962bc592a1e3f3a03cf
Showing with 9 additions and 8 deletions.
  1. +9 −8 ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs
@@ -909,11 +909,12 @@ void ReadDefAttribute()
break;
default:
string recordName = stringTable[identifier];
if (recordName != "Key") throw new NotSupportedException(recordName);
pd = new PropertyDeclaration(recordName, XamlTypeDeclaration);
if (keys == null)
keys = new List<KeyMapping>();
keys.Add(new KeyMapping(text) { Position = -1 });
if (recordName == "Key") {
if (keys == null)
keys = new List<KeyMapping>();
keys.Add(new KeyMapping(text) { Position = -1 });
}
break;
}

@@ -1408,10 +1409,10 @@ string GetExtension(TypeDeclaration declaration, string value)
string GetTypeExtension(short typeIdentifier)
{
string prefix = LookupPrefix(XmlToClrNamespaceMapping.XamlNamespace, false);
if (String.IsNullOrEmpty(prefix))
return String.Format("{{Type {0}}}", FormatTypeDeclaration(GetTypeDeclaration(typeIdentifier)));
else
return String.Format("{{{0}:Type {1}}}", prefix, FormatTypeDeclaration(GetTypeDeclaration(typeIdentifier)));
string typeName = FormatTypeDeclaration(GetTypeDeclaration(typeIdentifier));
if (string.IsNullOrEmpty(prefix))
return string.Format("{{Type {0}}}", typeName);
return string.Format("{{{0}:Type {1}}}", prefix, typeName);
}

string FormatTypeDeclaration(TypeDeclaration typeDeclaration)

0 comments on commit 888d6b6

Please sign in to comment.
You can’t perform that action at this time.