yck1509 / ConfuserEx

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

[Bug] Unknown Error Occured when obfuscating #594

Open jaymarvels opened 7 years ago

jaymarvels commented 7 years ago

Tried to obfuscate my binaries, using the "normal" preset, hit the protect button and get the following error:

[ERROR] Unknown error occurred. Exception: System.Collections.Generic.KeyNotFoundException: Cannot find protection with id 'debug'. at Confuser.Core.ObfAttrParser.ParseProtectionString(IDictionary2 settings, String str) in e:\Source\Public\Confuser2\Confuser.Core\ObfAttrParser.cs:line 87 at Confuser.Core.ObfAttrMarker.ProtectionSettingsStack.ApplyInfo(IDnlibDef context, ProtectionSettings settings, IEnumerable1 infos, ApplyInfoType type) in e:\Source\Public\Confuser2\Confuser.Core\ObfAttrMarker.cs:line 111 at Confuser.Core.ObfAttrMarker.ProtectionSettingsStack.Apply(IDnlibDef target, IEnumerable1 infos) in e:\Source\Public\Confuser2\Confuser.Core\ObfAttrMarker.cs:line 95 at Confuser.Core.ObfAttrMarker.MarkModule(ProjectModule projModule, ModuleDefMD module, Dictionary`2 rules, Boolean isMain) in e:\Source\Public\Confuser2\Confuser.Core\ObfAttrMarker.cs:line 428 at Confuser.Core.ObfAttrMarker.MarkProject(ConfuserProject proj, ConfuserContext context) in e:\Source\Public\Confuser2\Confuser.Core\ObfAttrMarker.cs:line 292 at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.cs:line 134 Failed at 15:27, 0:00 elapsed.

Information:

Unable to share source code/binaries due to the sensitivity of them.

Really hoping you can help as Eazfuscator (Free) doesn't support Roslyn compiled apps.

sumeetkpatel commented 6 years ago

Also having this problem.

5>  [ERROR] Unknown error occurred.
5>  Exception: System.Collections.Generic.KeyNotFoundException: Cannot find protection with id 'embed OneOfMyDependencies.dll'.
5>     at Confuser.Core.ObfAttrParser.ParseProtectionString(IDictionary`2 settings, String str) in e:\Source\Public\Confuser2\Confuser.Core\ObfAttrParser.cs:line 87
5>     at Confuser.Core.ObfAttrMarker.ProtectionSettingsStack.ApplyInfo(IDnlibDef context, ProtectionSettings settings, IEnumerable`1 infos, ApplyInfoType type) in e:\Source\Public\Confuser2\Confuser.Core\ObfAttrMarker.cs:line 111
5>     at Confuser.Core.ObfAttrMarker.ProtectionSettingsStack.Apply(IDnlibDef target, IEnumerable`1 infos) in e:\Source\Public\Confuser2\Confuser.Core\ObfAttrMarker.cs:line 95
5>     at Confuser.Core.ObfAttrMarker.MarkModule(ProjectModule projModule, ModuleDefMD module, Dictionary`2 rules, Boolean isMain) in e:\Source\Public\Confuser2\Confuser.Core\ObfAttrMarker.cs:line 428
5>     at Confuser.Core.ObfAttrMarker.MarkProject(ConfuserProject proj, ConfuserContext context) in e:\Source\Public\Confuser2\Confuser.Core\ObfAttrMarker.cs:line 292
5>     at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token) in e:\Source\Public\Confuser2\Confuser.Core\ConfuserEngine.cs:line 134

Looks like it was a class I use to serialize out settings, I have an Obfuscation Exclude attribute there which prevents proper handling since renamed attributes will get written to a file like that. ConfuserEx doesn't seem to support excluding features for particular classes etc.

[Obfuscation(Feature = "renaming", Exclude = true, ApplyToMembers = true)]

What a deal breaker, though I did managed to get it working using the namespace attributes, but its hard to tell if it even works.