ConfuserEx icon indicating copy to clipboard operation
ConfuserEx copied to clipboard

WPF application not working after rename protection

Open ElektroKill opened this issue 6 years ago • 5 comments

When I protect the following app with rename protection it no longer displays the pages properly, after protecting I copied the dll files into the Confused directory to get it to load. I am using the 2.0 branch.

Unprotected.zip

ElektroKill avatar Oct 20 '19 17:10 ElektroKill

Any updates ?

ElektroKill avatar Oct 31 '19 15:10 ElektroKill

The issue is that the binding expressions in the XAML files are not handled properly. This will take some time to fix. The problem is that the constructor parameter of the expression is not mapped to the property in the classes.

In detail this expression causes the issue:

DataContext="{Binding ApplicationViewModel.CurrentPage, Source={x:Static viewModel:ViewModelLocator.Instance}, Converter={valueConverters:ApplicationPageValueConverter}}"

ApplicationViewModel.CurrentPage is not resolved to the property in ViewModelLocator. Fixing this will take some time, because handling the binding expressions separately, can't be easily done in the way how the BAML analysis works now. I suggest disabling the renaming of both the ApplicationViewModel property and the CurrentPage property to work around this issue for now.

mkaring avatar Nov 03 '19 16:11 mkaring

So basically a lot of the baml analysis code will have to be rewritten?

ElektroKill avatar Nov 03 '19 18:11 ElektroKill

The parts that handle the processing those bindings need to anyway. They don't take into consideration what is used as the source for the binding and assume that the type will match with the property the binding writes to. That works sometimes, but it absolutely does not work for the DataContext.

mkaring avatar Nov 05 '19 18:11 mkaring

I solved this in my project via a work-a-round. If i see a binding is after protection broken, so i set the binding in the constructor CS. This works for me.

jomNext avatar Nov 22 '23 21:11 jomNext