Open pulawskig opened 5 years ago
Try adding the full absolute path to System.Private.CoreLib.dll
into the reference. ConfuserEx can't resolve the path to .NET Core properly as of right now.
Hey, thanks for answering :) I wasn't sure if you meant in .crproj or in project so I did both, but unfortunately it didn't help. I'm attaching .crproj and .csproj. Also I'm building/publishing for win-x86 if it helps.
MyApp_csproj.txt MyApp_crproj.txt (Had to rename them to attach)
In the csproj file it shouldn’t be required to add this file explicitly. The reference to netcoreapp2.2 should take care of this.
My guess is that other references to .NET Core are missing. Could you try to add the runtime assembly path of .NET Core to the crproj file? You are able to find the directory using the dotnet command line.
Sorry for the delay. Unfortunately adding the runtime path didn't work (got it via dotnet --list-runtimes
command).
MyApp_crproj.txt
Could it be connected with #46 ? In it you mentioned a problem with type redirects in .NET Standard and .NET Core. I made two simple exactly the same programs in Standard 2.0 and Core 2.2 ( Program.txt ), and the first went without any problems, and the other got the Exception for IAsyncStateMachine.
I still have this problem in .net 5.
Using the following:
<?xml version="1.0" encoding="utf-8"?>
<project baseDir="." outputDir="." xmlns="http://confuser.codeplex.com">
<rule preset="minimum" pattern="true">
<protection id="anti debug" />
<!--<protection id="anti dump" />-->
<protection id="anti ildasm" />
<!--<protection id="anti tamper" />-->
<protection id="constants" />
<protection id="ctrl flow" />
<!--<protection id="invalid metadata" />-->
<!--<protection id="ref proxy" />-->
<protection id="rename" />
<protection id="resources" />
</rule>
<module path="ConnectorLib.dll" />
<probePath>C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.1\</probePath>
</project>
Expectation: It works. It used to when the target was .NET Framework.
Result:
1>Exception: dnlib.DotNet.TypeResolveException: Could not resolve type: System.Runtime.CompilerServices.IAsyncStateMachine (System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
1> at dnlib.DotNet.TypeRef.ResolveThrow(ModuleDef sourceModule) in C:\Users\KatDevsGames\source\repos\ModPhuserEx\dnlib\src\DotNet\TypeRef.cs:line 334
It's not finding some classes that get used implicitly by the async/await keywords. The probePath
path definitely contains System.Runtime.dll
.
I added System.Runtime.dll
library to target folder and it fixed
Hello, I'm trying to use ConfuserEx 2 on my .NET Core 2.2 app, but it fails with
Exception: dnlib.DotNet.TypeResolveException: Could not resolve type: System.Runtime.CompilerServices.IAsyncStateMachine (System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
After some debugging I noticed two things:System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
I've tried referencing System.Private.CoreLib as external module, but no luck. I've removed any additional options from .crproj so right now it looks like this:
`
`
Has anyone experienced something like this and/or knows how to a fix/workaround for it? Thank you for any help and have a nice day :)