mkaring / ConfuserEx

An open-source, free protector for .NET applications
https://mkaring.github.io/ConfuserEx/
MIT License
2.31k stars 350 forks source link

Fixed detection of blocking references across multiple assemblies #425

Closed mkaring closed 2 years ago

mkaring commented 2 years ago

fixes #379

mkaring commented 2 years ago

@KvanTTT: Could you test this version in your projects?

AppVeyorBot commented 2 years ago

:white_check_mark: Build ConfuserEx 886 completed (commit https://github.com/mkaring/ConfuserEx/commit/f0c4f2cf47 by @mkaring)

KvanTTT commented 2 years ago

Unfortunately, another error appeared. I'm trying to figure out a reason.

mkaring commented 2 years ago

That was a pretty major change to the way the way the dependencies are resolved, because before some of the references were only "known" on one direction (the inheriting method knew about the inherited method, but not the other way around). I changed that, the tests did look good, but I am not 100% sure if that introduced some new weirdness.

The problems are mainly caused if members that are called across multiple assemblies need to be renamed. This causes all sorts of strange side effects.

KvanTTT commented 2 years ago

It seems like there is something wrong with crossreference properties renaming:

System.TypeInitializationException: The type initializer for 'XXX' threw an exception. ---> System.TypeLoadException: Method 'get_Logger' in type '_YbY95Z8ef8fZ0hNbp9Bl6R07inP' from assembly 'YYY, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
   at _Lp1dCrrC6WtbAIfGTxJRjSwiWWb._Rq1CPdIekKPykD0eUP8zxKmKCnZ()
   at ZZZ..cctor()
   --- End of inner exception stack trace ---
   at WWW..ctor(SourceRepository , _bpohhAchrs62TGia1PpDFVZmNBn )
   at _U2UXRQIJWJL0xcUbI1mErr33wNJ.‪‌‍‍‪‪‫‬‪‫‌‭‍‫‏‌‬​​‮‭‫‎‮(SourceRepository , _bpohhAchrs62TGia1PpDFVZmNBn )
   at _U2UXRQIJWJL0xcUbI1mErr33wNJ._71mdiZBHggKw2KWOFnjdtHe8hYu()
   at _U2UXRQIJWJL0xcUbI1mErr33wNJ._mjUwxZWUtQoByzaSlmVua9N6O9A()

Moreover, this property is not being renamed. But I still can not extract minimal reproducible example :(

KvanTTT commented 2 years ago

May be somebody else can test the assembly and check if it has errors?

wmjordan commented 2 years ago

The artifact on appveyor has been removed. How to obtain a binary?

KvanTTT commented 2 years ago

At least it's possible to build ConfuserEx manually.

KvanTTT commented 2 years ago

Generally, I accept this patch. Also, I think it makes sense to merge that request: https://github.com/mkaring/ConfuserEx/pull/385 since I was not able to extract another minimal sample for bug that prevents correct naming obfuscation.

mkaring commented 2 years ago

So I'm merging that for now. The effect of the change is that renaming across assemblies that require inheritance issues to be resolved are generally blocked. Meaning no renaming will happen. There is no other solution for this right now, because ConfuserEx is processing each assembly at this stage individually. It solve this properly it would have to join the assemblies together to obfuscate them as a unit.