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

baml decompiler error with namespace on unreferenced assembly #1436

Closed
weltkante opened this Issue Mar 1, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@weltkante
Copy link
Contributor

weltkante commented Mar 1, 2019

Apparently it is valid xaml to have a namespace against an assembly which you do not reference. You can't use that namespace but it is recorded into the baml and causes ILSpy to fail decompilation

Example:

<Window x:Class="WpfSandbox.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:a="clr-namespace:WpfSandbox;assembly=SomeUnknownAssembly">
</Window>

fails with

System.ArgumentNullException: Der Wert darf nicht NULL sein.
Parametername: asm
   bei ILSpy.BamlDecompiler.Xaml.NamespaceMap..ctor(String prefix, IModule asm, String xmlNs, String clrNs) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\Xaml\NamespaceMap.cs:Zeile 39.
   bei ILSpy.BamlDecompiler.XmlnsDictionary.SetPIMapping(String xmlNs, String clrNs, IModule assembly) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\XmlnsDictionary.cs:Zeile 63.
   bei ILSpy.BamlDecompiler.XamlContext.BuildPIMappings(BamlDocument document) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\XamlContext.cs:Zeile 86.
   bei ILSpy.BamlDecompiler.XamlContext.Construct(IDecompilerTypeSystem typeSystem, BamlDocument document, CancellationToken token, BamlDecompilerOptions bamlDecompilerOptions) in E:\_code\_dev\ilspy\ILSpy.BamlDecompiler\XamlContext.cs:Zeile 62.
   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 42.
   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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.