yck1509 / ConfuserEx

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

MemberRefResolveException #62

Closed barnacleboy closed 9 years ago

barnacleboy commented 10 years ago

Hi!

After a few test runs I have to admit that the current version is really awesome! Great work!

The result looks flawless when obfuscating the library assemblies. Nearly everything works as expected. But when obfuscating a call to the following method, I'm getting the MemberRefResolveException.

[ERROR] Failed to resolve a member, check if all dependencies are of correct version. Exception: dnlib.DotNet.MemberRefResolveException: Could not resolve method/field: System.Void Common.Base.NotificationObject`1<!0>::OnNotifyPropertyChanged<!!0>

The signature of the method reads as follows:

protected virtual void OnNotifyPropertyChanged<U>(Expression<Func<U>> selector)

I'm using this function call several times in all project assemblies, since it is declared in a base class of my Common assembly. Several libraries that are calling or overwriting this method are perfectly obfuscated, but when I'm adding my exe assembly I'm getting an error because the comparison of the method signatures fail, as soon the exe's call is getting obfuscated:

Library: 
{System.Void <!!0>(System.Linq.Expressions.Expression`1<System.Func`1<U>>)}
Exe: 
{System.Void <!!0>(System.Linq.Expressions.Expression`1<System.Func`1<!!0>>)}

Problem could be that my main exe is .NET 4.0 and several class libraries are just .NET 3.5 because I would like to ship them as an independent framework - so the exe is the only .NET 4.0 assembly here. I also noticed that several obfuscated assemblies are .NET 4.0 after obfuscation. Any change to change the framework back to 3.5 for obfuscated file?

Thanks for your work and help in advance!

Cheers P

barnacleboy commented 10 years ago

I've changed now the framework to 3.5 for the exe and everything is working as expected. Checked the assembly manifest with ILDASM (turned off the protection of course ;)) and it shows CLR 2... :)

Only problem is now the bigger memory footprint of WPF in 3.5 vs. 4.0 - but that has nothing to do with ConfuserEx...

yck1509 commented 10 years ago

The framework version get changed would be a bug of ConfuserEx. Would it be possible to send the assemblies to confuser.net@gmail.com for me to have a look?

yck1509 commented 10 years ago

Close due to inactivity. If you're are still encountering this issue, please feel free to reopen the issue with more information.

barnacleboy commented 10 years ago

Sorry for the late reply! I've sent you a sample application that includes the same class that makes troubles.

Thank you for looking into the issue!

barnacleboy commented 9 years ago

@yck1509: Could you please re-open the issue. I am not able to re-open it again.

yck1509 commented 9 years ago

Strangely it seems I didn't receive your sample. Could you please resent it again to confuser.net@gmail.com ?

barnacleboy commented 9 years ago

Resent it again. The zip was getting blocked so I've renamed it to a .doc file.

barnacleboy commented 9 years ago

Works fine now! Thank you!