Obfuscating Nuget package targeting .NET Standard works on machine on .NET 4.7.1, fails on 4.5.2.

mihaliosmihalios Posts: 1 New member
edited November 2, 2018 1:50PM in SmartAssembly
My project is referencing a nuget package (System.ValueTuple 4.3.0, targeting .netstandard).
The code is obfuscated using SmartAssembly 6.10 (I'm aware this version doesn't support .NET Standard).

The program works fine on a machine running .NET 4.7.1.
The program fails on a machine running .NET 4.5.2 when Value Tuple code is reached with:
System.InvalidProgramException: Common Language Runtime detected an invalid program

I understand why this fails on 4.5.2 but it's unclear why it's working on 4.7.1. If my version of SmartAssembly doesn't support .NET Standard I'd expect to see the exception on both machines, regardless of .NET version. 



  • Options
    There could be a false assumption that newer things shouldn't work if the older doesn't. .NET Standard is a weird creature.

    Each .NET Framework starting from 4.5 version implements other .NET Standard versions. According to this compatibility table https://docs.microsoft.com/pl-pl/dotnet/standard/net-standard the .NET Framework 4.5.2 is .NET Standard 1.2. Earlier .NET Standard versions (those before 2.0) were done differently internally - some other dependencies are imported inside (things like netstandard.dll, System.Private.CoreLib.dll, mscorlib.dll, NETStandard.Library). The .NET Development Team decided to take a different approach between versions. Firstly, when they developed .NET Core 1.0, they decided to import everything from NuGet. Later they decided to take approach a little closer to .NET Framework - some things are already within .NET Core on-system installation. That's because all-nuget was a mess with patching core assemblies.

    That doesn't answer this case specifically but gives some hints why some things may or may not work. Without a reproduction it's hard to say why your specific case is failing.
    Have you visited our Help Centre?
Sign In or Register to comment.