yck1509 / ConfuserEx

An open-source, free protector for .NET applications
http://yck1509.github.io/ConfuserEx/
Other
3.57k stars 1.64k forks source link

Output Un-runnable #267

Closed alexmurari closed 9 years ago

alexmurari commented 9 years ago

Hello, To test the stability of ConfuserEx I tried to confuse the sample application of MahApps metro framework, it's an application that uses many WPF functions and it's a good testing ground. GitHub page: https://github.com/MahApps/MahApps.Metro (the sample project is in the 'sample' folder). The compiled sample's link is in the end of this thread. It's output is simple: one exe and one DLL compiled (the other DLLs in the folder are external resources, some aren't even used).

No matter what kind of protection I use (or disable it at all) the MetroDemo.exe is OK and runnable, but the MahApps.Metro.dll gets broken and the app crashes at startup. (If I just confuse the exe and use the original MahApps.Metro.dll everything works fine, the problem is with this DLL).

Te folowing warning is shown while confusing this DLL: [WARN] Failed to extract dependency property name in 'System.Void MahApps.Metro.Controls.Dialogs.ProgressDialog::.cctor()'. [WARN] Failed to extract dependency property name in 'System.Void MahApps.Metro.Controls.FlipView::.cctor()'. [WARN] Failed to extract dependency property name in 'System.Void MahApps.Metro.Controls.Dialogs.MessageDialog::.cctor()'. [WARN] Failed to extract dependency property name in 'System.Void MahApps.Metro.Controls.NumericUpDown::.cctor()'. [WARN] Failed to extract dependency property name in 'System.Void MahApps.Metro.Controls.Planerator::.cctor()'. [WARN] Failed to extract dependency property name in 'System.Void MahApps.Metro.Controls.ToggleSwitchButton::.cctor()'. [WARN] Failed to extract dependency property name in 'System.Void Microsoft.Windows.Shell.WindowChrome::.cctor()'. [WARN] Failed to find the accessors of attached dependency property 'WindowPlacementSettings' in type 'MahApps.Metro.Controls.WindowSettings'. [WARN] Failed to find the accessors of attached dependency property 'OriginalBehaviorInternal' in type 'MahApps.Metro.Behaviours.StylizedBehaviors'. [WARN] Failed to extract dependency property name in 'System.Void MahApps.Metro.Controls.ToggleSwitch::.cctor()'.

Here is the original sample application compiled (so you don't need to do it yourself): http://www54.zippyshare.com/v/7iDstcLf/file.html

Thanks.

yck1509 commented 9 years ago

Hi, You need to disable xaml renaming for this one, as external application depends on the name of the xaml:

    <protection id="rename">
      <argument name="renXaml" value="false" />
    </protection>
alexmurari commented 9 years ago

Hi, I tried that, no sucess. Even if I remove all protections the output doesn't run.

Maybe it's related to dnlib, in the assembly write process...

yck1509 commented 9 years ago

Hi, The output runs fine here. Please post the content of the crproj file for me to have a look.

alexmurari commented 9 years ago

Here it go. (Im using the latest version of ConfuserEx avaible at th CI Server).

 <project outputDir="D:\Projetos\cSharp\Misc\MahApps.Metro\trunk\samples\MetroDemo\bin\NET40\Debug\Confused"
baseDir="D:\Projetos\cSharp\Misc\MahApps.Metro\trunk\samples\MetroDemo\bin\NET40\Debug" xmlns="http://confuser.codeplex.com">
  <rule pattern="true" inherit="false">
    <protection id="anti ildasm" />
    <protection id="anti tamper" />
    <protection id="constants" />
    <protection id="ctrl flow" />
    <protection id="anti dump" />
    <protection id="anti debug" />
    <protection id="invalid metadata" action="remove" />
    <protection id="ref proxy" />
    <protection id="resources" />
    <protection id="rename" >
        <argument name="renXaml" value="false" />
    </protection>
  </rule>
  <module path="MetroDemo.exe" />
  <module path="MahApps.Metro.dll" />
</project>
yck1509 commented 9 years ago

The problem seems to be with Resources protection. Disabling it should work.

alexmurari commented 9 years ago

Thats right, disabling resources protection worked here. Thanks.