Open VBAndCs opened 3 years ago
You and anyone else are very welcome to contribute this. The decompilation pipeline might need some adjustments / additional information passed in so that the code generated by XAML compilation can be transformed properly, if you want to dive into this and need some help, please feel free to ask questions.
Also possible to do (if assembly contains that information)
XamlIntelliSenseFileGenerator
for .xaml files instead of MSBuild:Compile
nowI'm sorry, probably I should create a separate issue thread for WPF issues with devexpress framework xaml files?
I tried to compile one of examples in DevExpress v21.2 library (DevExpress.StockMarketTrader.Wpf project),
then opened .exe file in ILSpy and exported project.
As I see, some decompiled xaml files have issues with compilation due to
1) Some string parameters haven't additional quotes, for example I see an attribute
Foreground="{DXBinding Expr=CurrentPrice - PreviousPrice > 0 ? @r(greenBrush) : @r(redBrush)}"
while original .xaml file had
Foreground="{DXBinding Expr='CurrentPrice - PreviousPrice > 0 ? @r(greenBrush) : @r(redBrush)'}"
As I see by debugging ILSpy.BamlDecompiler project, originally single quotes were in XML document, but they were omitted later on rewrite passes. Also another product, dotPeek, decompiles .baml files without losing quotes here. Though, it have another problems with correct reconstruction of XAML markup.
2) Sometimes tag inside tag is decompiled as attribute of some tag (why attribute, I don't know) 3) Sometimes strange namespace declarations introduced in the middle of .xaml document, while original .xaml file haven't this namespace declarations 4) Not necessary, but original file were pretty formatted (one attribute in a row), while decompiled .xaml file places all attributes of each tag in a single row
When decompiling WPF, please take care of code-behind files:
.cs
, and place this file in the same folder as the xaml file.private bool _contentLoaded;
. Delete them.Buid Action
for App.xaml ispage
, while it should beApplicationDefinition
.Buid Action
for resources like images isEmbeddedResource
, while it should beResource
.There is also a general behavior (not a WPF explosive) of creating all folders in one level with qualified names, which cause many errors with resource paths (as images, xaml, cshtml, etc). Please get rid of the namespace part, and nest folders.
Any doable part of these suggestion will save a lot of users time. Thanks