开发者

How to decompile complex BAML to valid XAML

开发者 https://www.devze.com 2023-03-13 14:48 出处:网络
I tried ILSpy, but it failed: System.NotImplementedException: StaticResourceStart в Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.ProcessNext()

I tried ILSpy, but it failed:

System.NotImplementedException: StaticResourceStart
   в Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.ProcessNext()
   в Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.ReadInternal()
   в Ricciolo.StylesExplorer.MarkupReflection.XmlBamlReader.Read()
   в System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
   в System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
   в System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
   в ILSpy.BamlDecompiler.BamlResourceEntryNode.LoadIntoDocument(IAssemblyResolver resolver, AssemblyDefinition asm, Stream stream)
   в ILSpy.BamlDecompiler.BamlResourceEntryNode.LoadBaml(AvalonEditTextOutput output)
   в ILSpy.BamlDecompiler.BamlResourceEntryNode.<>c__DisplayClass3.<View>b__1()

I tried Baml Viewer for .Net Reflector, but it was unable to generate valid XAML.

The main problem was with Binding that reference to wrong StaticResource.

For example (namedViews is CollectionViewSource):

   Visibility="{Bi开发者_StackOverflow社区nding Path=Value, Converter={StaticResource namedViews}}"
   ToolTip="{StaticResource namedViews}"

What other applications exist to decompile BAML? Any patch to BAML Viewer?


Not sure if this will help you, but if you can run the application, you can use Snoop to run through the structure of a WPF application.

Other options:

  • dotPeek (but I believe it needs the Baml4dotPeek plugin which is based on Baml Viewer for Reflector, which, as you said, didn't work.)
  • JustDecompile (you have to register with Telerik, I believe)
  • Woodstock for WPF

I've only tried Snoop and like it very much, but that didn't seem to solve your problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号