Roslyn: Cannot use C# 7 tuple literals in VS 2017 interactive window

Created on 7 Jul 2017  路  9Comments  路  Source: dotnet/roslyn

Version Used:
Microsoft (R) Roslyn C# Compiler version 2.2.0.61624

Steps to Reproduce:

  1. Open the interactive Window in VS 2017 15.2 (26430.15)
  2. Write (int, int) x;
  3. You'll get the following error: (1,1): error CS8179: Predefined type 'System.ValueTuple`2' is not defined or imported

Expected Behavior:
Code should have compiled properly

Actual Behavior:
Code fails

4 - In Review Area-Interactive Interactive-ScriptingIDE New Language Feature - Tuples

Most helpful comment

Confirmed that works.

All 9 comments

:memo: I believe you can do this if you do the following:

#r "System.ValueTuple.dll"

It would be nice if this was automatic.

It is supposed to be automatic. @weitzhandler What OS do you run on?

@sharwell

I believe you can do this if you do the following...

I tried that, and that error message still appears.


@tmat

It is supposed to be automatic. @weitzhandler What OS do you run on?

I'm on Windows 10 Home ver. 1703 (build 15036.413).

The issue is that within Interactive Window, the live errors showing multiple assembly defined the same ValueTuple type (conflict with System.ValueTuple, and mscorlib), But you can execute the code without any compilation error.

@weitzhandler I suspect you have .NET Framework 4.7 installed on that machine. Could you confirm?

That said, the EE and scripting hosts are supposed to tolerate such duplicate types (https://github.com/dotnet/roslyn/pull/17192). Not sure what is the problem.

@jcouv
.NET 4.7 is on my machine, and I know that because I have 4.7 templates in VS.

@sharwell @tmat @mazhou-msft @jcouv
I can't get tuples to work in the interactive window at all.
Here's the my console text:

> #reset
Resetting execution engine.
Loading context from 'CSharpInteractive.rsp'.
> #r "System.ValueTuple.dll"
> (int, int) x;
(1,1): error CS8179: Predefined type 'System.ValueTuple`2' is not defined or imported
> 

Fixed by #21851 as part of 15.5

Confirmed that works.

Was this page helpful?
0 / 5 - 0 ratings