Browse Source

Fix #2052: resolve XML namespaces of properties

pull/2426/head
Siegfried Pammer 4 years ago
parent
commit
a78b592bf6
  1. 6
      ILSpy.BamlDecompiler.Tests/BamlTestRunner.cs
  2. 3
      ILSpy.BamlDecompiler.Tests/Cases/Issue2052.xaml
  3. 3
      ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj
  4. 1
      ILSpy.BamlDecompiler/Handlers/Records/PropertyHandler.cs

6
ILSpy.BamlDecompiler.Tests/BamlTestRunner.cs

@ -136,6 +136,12 @@ namespace ILSpy.BamlDecompiler.Tests @@ -136,6 +136,12 @@ namespace ILSpy.BamlDecompiler.Tests
RunTest("cases/issue1547");
}
[Test]
public void Issue2052()
{
RunTest("cases/issue2052");
}
[Test]
public void Issue2097()
{

3
ILSpy.BamlDecompiler.Tests/Cases/Issue2052.xaml

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid x:Key="grid" x:XmlAttributeProperties.XmlSpace="preserve" />
</ResourceDictionary>

3
ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj

@ -89,6 +89,9 @@ @@ -89,6 +89,9 @@
<Page Include="Cases\Issue1547.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Cases\Issue2052.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Cases\Issue2097.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>

1
ILSpy.BamlDecompiler/Handlers/Records/PropertyHandler.cs

@ -38,6 +38,7 @@ namespace ILSpy.BamlDecompiler.Handlers @@ -38,6 +38,7 @@ namespace ILSpy.BamlDecompiler.Handlers
var elemType = parent.Xaml.Element.Annotation<XamlType>();
var xamlProp = ctx.ResolveProperty(record.AttributeId);
var value = XamlUtils.Escape(record.Value);
xamlProp.DeclaringType.ResolveNamespace(parent.Xaml, ctx);
parent.Xaml.Element.Add(ConstructXAttribute());

Loading…
Cancel
Save