0

This is a pretty massive project (and protected) so I can't share the content, but I'm encountering a compilation error, only in my release configuration:

EXEC : error : Error occurred during processing of input file 'NAME.dll' --> Stage 'Phase 1': Error at 'NAME.il':1589 --> Encountered a cyclic dependency in chain of forwarders for type 'System.Type, netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

When I compile in release mode, the assembly is obfuscated using Gapotchenko Eazfuscator (version 2021.4.430), and I believe this error is occurring during the obfuscation phase since the follow up to the previous error is:

NAME.dll : error : Obfuscation failed
Done building project "NAME.csproj" -- FAILED.

I've searched high and low for related issues, and all I keep finding are circular references in code. When I search through my code, I'm not finding any, and the error is pointing to System.Type in .NET Standard, which is either very generic, or very unhelpful, but likely both. I checked all of my assemblies and none of them seem to reference this directly.

Non-Custom Dependencies

The following dependencies are installed via NuGet or referenced directly as a DLL:

  • Assemblies
    • System.Windows.Forms
  • Frameworks
    • Microsoft.AspNetCore.App
    • Microsoft.NETCore.App
  • Packages
    • Gapotchenko.Eazfuscator.NET (202.4.430)
    • Newtonsoft.Json (13.0.1)
    • Swashbuckle.AspNetCore (5.6.3)
    • System.Configuration.Configurationmanager (5.0.0)
    • System.Data.SqlClient (4.8.2)
    • System.ServiceProcess.ServiceController (5.0.0)
Custom Dependencies

There are three additional projects referenced directly by the one that isn't compiling (they compile just fine); let's call them A, B, and C. These projects all run on .NET Framework (target 4.7.2). They all have their own rather large lists of dependencies I can search through, with guidance based on the dependency list for the project that is failing to compile.

Additionally, there are infinitely many (albeit, currently just one) assemblies running on .NET Framework (target 4.7.2) loaded at runtime, though I'm not sure what this would have to do with compile-time, I'm including it, just in case it's important to know that dependency injection is involved at runtime.

For clarity, my debug configuration compiles and runs just fine while my release configuration does not. Additionally, my target framework is .NET 5.0.


How can I locate the cyclic dependency here and eliminate it?

Hazel へいぜる
  • 2,751
  • 1
  • 12
  • 44
  • Wait, what is System.Windows.Forms doing in a web application? – madreflection Oct 21 '21 at 22:02
  • @madreflection there are assemblies loaded at runtime that require it and the web app refused to run without a direct reference to it. Ultimately the goal is to have that loaded at runtime through a dependencies folder too. – Hazel へいぜる Oct 21 '21 at 22:06
  • I think you need to reproduce the problem minimally (good ol' MRE) to isolate the cause. But my guess is that there may be a bug in the obfuscator related to mixing NETFramework and NETStandard/NETCoreApp asemblies. In .NET 5, netstandard.dll forwards `System.Type` to System.RunTime.dll, which forwards it to System.Private.CorLib.dll; mscorlib.dll forwards its `System.Type` to System.Private.CorLib.dll, as well. The obfuscator may be getting mixed up by that, possibly because mscorlib in NETFramework has a different inheritance chain for `System.Type` than NETStandard and NETCoreApp do. – madreflection Oct 21 '21 at 22:47
  • @madreflection that's what I'm afraid of, to be honest. I'm in the middle of pursuing that route now. – Hazel へいぜる Oct 22 '21 at 00:11

0 Answers0