Error CS8179 when you debug an application on a computer that has .NET Framework 4.7 installed

Applies to: Microsoft .NET Framework 4.7

Symptoms


Assume that you have an application on a computer that has the .NET Framework 4.7 installed. The application targets the .NET Framework 4.6 and involves tuples (assume that you have added a reference to a ValueTuple package). 

When you debug this application, error CS8179 occurs in the Expression Evaluator (Immediate Window, Watch, QuickWatch) type. This is because the compiler found two instances of the well-known type that are ambiguous.

Note This issue also occurs in scripting and the Interactive Window.

Cause


This error occurs because the implementation of ValueTuple types is included in the different assemblies that are loaded by the application.

Both Expression Evaluator and the scripting engines load the assemblies that are referenced by the application. This means that ValueTuple.dll and Mscorlib.dll (4.7) are loaded, and both include an implementation of ValueTuple types. The implementations of ValueTuple types do not unify.

Workaround


To work around this issue, recompile the application against the .NET Framework 4.7 instead of the .NET Framework 4.6 or earlier versions, and then remove the reference to the ValueTuple package, if possible. After you do this, only one implementation of ValueTuple will be present.

Note A fix for this issue is expected in a future release of the .NET Framework.

For more information about known issues in the .NET Framework 4.7, see Known issues for the .NET Framework 4.7.