Reputation: 5085
I am using Eazfuscator.NET 3.0.41 to obfuscate a (VS 2010) WPF 4 application. After obfuscating, when I double click the exe file it's throwing an error message like this.
"Description: The process was terminated due to an unhandled exception. Exception Info: System.Windows.Markup.XamlParseException"
Is there a way I could enable some sort of a logging to check where it's going wrong ? How can I solve this problem? please advice
Upvotes: 1
Views: 1293
Reputation: 5085
Thanks for your quick response.
I found the solution to this. Here is what happens.
When Eazfuscator obfuscates WPF applications it doesn't obfuscate BAML code, but it does change the method names that refers to BAML like OnMouseClick events. So when the app loads it will look for corresponding events and since they are not there anymore it will trigger this error.
To solve this problem, each event that binds to an event in WPF must be flaged with this singature
[System.Reflection.Obfuscation(Exclude = true)]
Eg.
[System.Reflection.Obfuscation(Exclude = true)]
private void Window_Loaded(object sender, RoutedEventArgs e)
{
}
Easiest way to troubleshoot these kinds of error is to open the VS 2010 editor, Change it to release mode and run.
Hope this will help someone else as well.
Upvotes: 5
Reputation: 234404
Opening the obfuscated output in Reflector might shed some light on it. Check if the class and property names in your XAML were renamed according to the corresponding classes and properties.
Upvotes: 2