mkaring / ConfuserEx

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

InvalidOperationException during "Building VTables & identifier list..." #369

Closed SilentSin closed 2 years ago

SilentSin commented 3 years ago

I get an error when running Confuser EX if I have anything that a) inherits from a class in UnityEngine.dll (from Unity 2019.4), and b) has a finalizer. Removing either the inheritance or the finalizer allows Confuser EX to run properly.

My Code:

public class MyClass : UnityEngine.Object
{
    ~MyClass() { }
}

Here's the compiled DLL: Animancer.Lite.zip

Error:

Exception: System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Confuser.Renamer.VTable.ConstructVTable(TypeDef typeDef, VTableStorage storage)
   at Confuser.Renamer.VTableStorage.GetOrConstruct(TypeDef type)
   at Confuser.Renamer.AnalyzePhase.Execute(ConfuserContext context, ProtectionParameters parameters)
   at Confuser.Core.ProtectionPipeline.ExecuteStage(PipelineStage stage, Action`1 func, Func`1 targets, ConfuserContext context)
   at Confuser.Core.ConfuserEngine.RunPipeline(ProtectionPipeline pipeline, ConfuserContext context)
   at Confuser.Core.ConfuserEngine.RunInternal(ConfuserParameters parameters, CancellationToken token)

Crproj file:

<?xml version="1.0" encoding="utf-8"?>
<project baseDir="bin\2019.4.Editor" outputDir="..\..\Confused\2019.4\Internal\Core" seed="666" xmlns="http://confuser.codeplex.com">
    <rule preset="none" pattern="true">
        <protection id="anti ildasm" />
        <protection id="ctrl flow" />
    <protection id="ref proxy" />
        <protection id="rename" />
    </rule>
    <module path="Animancer.Lite.dll" />
</project>

The error still occurs even if I remove all protections from the crproj.

mkaring commented 3 years ago

Please try the solution in #370 to fix this issue as well.

github-actions[bot] commented 2 years ago

This issue needs more information and has not had recent activity. Please provide the missing information or it will be closed in 7 days. Thanks!

github-actions[bot] commented 2 years ago

Closing this issue because it needs more information and has not had recent activity. Please re-open this issue if more details can be provided. Thanks!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.