Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.DotNet.Cli.Utils.Product' threw an exception. ---> System.BadImageFormatException: Could not load file or assembly 'System.Reflection.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An attempt was made to load a program with an incorrect format.
at Microsoft.DotNet.Cli.Utils.Product.GetProductVersion()
at Microsoft.DotNet.Cli.Utils.Product..cctor()
--- End of inner exception stack trace ---
at Microsoft.DotNet.Cli.MulticoreJitProfilePathCalculator.CalculateProfileRootPath()
at Microsoft.DotNet.Cli.MulticoreJitActivator.StartCliProfileOptimization()
at Microsoft.DotNet.Cli.MulticoreJitActivator.TryActivateMulticoreJit()
at Microsoft.DotNet.Cli.Program.Main(String[] args)
Aborted
Additional information (e.g. issue happens only occasionally)
Doesn't happen on build without docker
Output of dotnet --info
NET Command Line Tools (2.1.4)
Product Information:
Version: 2.1.4
Commit SHA-1 hash: 5e8add2190
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/2.1.4/
Microsoft .NET Core Shared Framework Host
Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54
I'm trying to build docker image but it fails on
dotnet restore
.Steps to reproduce the issue
Dockerfile
.csproj
Expected behavior
Image built
Actual behavior
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.DotNet.Cli.Utils.Product' threw an exception. ---> System.BadImageFormatException: Could not load file or assembly 'System.Reflection.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An attempt was made to load a program with an incorrect format.
at Microsoft.DotNet.Cli.Utils.Product.GetProductVersion() at Microsoft.DotNet.Cli.Utils.Product..cctor() --- End of inner exception stack trace --- at Microsoft.DotNet.Cli.MulticoreJitProfilePathCalculator.CalculateProfileRootPath() at Microsoft.DotNet.Cli.MulticoreJitActivator.StartCliProfileOptimization() at Microsoft.DotNet.Cli.MulticoreJitActivator.TryActivateMulticoreJit() at Microsoft.DotNet.Cli.Program.Main(String[] args) Aborted
Additional information (e.g. issue happens only occasionally)
Doesn't happen on build without docker
Output of
dotnet --info
Output of
docker info