Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new baml decompiler does not qualify Namy property correctly #1435

Closed
weltkante opened this issue Mar 1, 2019 · 3 comments
Closed

new baml decompiler does not qualify Namy property correctly #1435

weltkante opened this issue Mar 1, 2019 · 3 comments

Comments

@weltkante
Copy link
Contributor

weltkante commented Mar 1, 2019

Working with current master branch, the baml decompiler no longer qualifies the Name properties correctly, leading to a parse exception when the same property appears on different namespaces.

Common example is x:Name conflicting with AutomationProperties.NameProperty because the latter will not be qualified correctly.

@siegfriedpammer
Copy link
Member

Could you post a small example I could use as unit test? I found some bugs already through our unit tests, but seems there's still more. Thank you!

@weltkante
Copy link
Contributor Author

What format do you need the example in? If xaml you can just set both x:Name and AutomationProperties.Name on a UserControl.

<UserControl
    x:Class="WpfSandbox.WpfControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Name="SomeControlName"
    AutomationProperties.Name="SomeAutomationName">
</UserControl>

fails with

System.InvalidOperationException: Doppeltes Attribut.
   bei System.Xml.Linq.XElement.AddAttribute(XAttribute a)
   bei ILSpy.BamlDecompiler.Handlers.PropertyHandler.Translate(XamlContext ctx, BamlNode node, BamlElement parent) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\Handlers\Records\PropertyHandler.cs:Zeile 44.
   bei ILSpy.BamlDecompiler.HandlerMap.ProcessChildren(XamlContext ctx, BamlBlockNode node, BamlElement nodeElem) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\IHandlers.cs:Zeile 80.
   bei ILSpy.BamlDecompiler.Handlers.ElementHandler.Translate(XamlContext ctx, BamlNode node, BamlElement parent) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\Handlers\Blocks\ElementHandler.cs:Zeile 41.
   bei ILSpy.BamlDecompiler.HandlerMap.ProcessChildren(XamlContext ctx, BamlBlockNode node, BamlElement nodeElem) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\IHandlers.cs:Zeile 80.
   bei ILSpy.BamlDecompiler.Handlers.DocumentHandler.Translate(XamlContext ctx, BamlNode node, BamlElement parent) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\Handlers\Blocks\DocumentHandler.cs:Zeile 34.
   bei ILSpy.BamlDecompiler.XamlDecompiler.Decompile(IDecompilerTypeSystem typeSystem, BamlDocument document, CancellationToken token, BamlDecompilerOptions bamlDecompilerOptions, List`1 assemblyReferences) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\XamlDecompiler.cs:Zeile 45.
   bei ILSpy.BamlDecompiler.BamlResourceEntryNode.LoadIntoDocument(PEFile module, IAssemblyResolver assemblyResolver, Stream stream, CancellationToken cancellationToken) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\BamlResourceEntryNode.cs:Zeile 66.
   bei ILSpy.BamlDecompiler.BamlResourceEntryNode.LoadBaml(AvalonEditTextOutput output, CancellationToken cancellationToken) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\BamlResourceEntryNode.cs:Zeile 56.
   bei ILSpy.BamlDecompiler.BamlResourceEntryNode.<>c__DisplayClass1_1.<View>b__2() in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\BamlResourceEntryNode.cs:Zeile 40.

@siegfriedpammer
Copy link
Member

Thank you very much!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants