Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# Interactive doesn't work with tuple syntax when desktop framework 4.7 is installed #17157

Closed
paulomorgado opened this issue Feb 15, 2017 · 12 comments

Comments

@paulomorgado
Copy link

Version Used:
Microsoft Visual Studio Enterprise 2017 RC 15.9.9-RC4+26206.0
Microsoft (R) Visual C# Interactive Compiler version 2.0.0.61404

Steps to Reproduce:

  • Microsoft Visual Studio Enterprise 2017 RC 15.9.9-RC4+26206.0
  1. Open the C# Interactive window.
  2. Enter (1,2)
  • Microsoft (R) Visual C# Interactive Compiler version 2.0.0.61404
  1. Run csi.exe
  2. Enter (1,2)

Expected Behavior:
Outputs [(1, 2)]

Actual Behavior:

  • Microsoft Visual Studio Enterprise 2017 RC 15.9.9-RC4+26206.0
    (1,13): error CS8179: Predefined type 'System.ValueTuple`2' is not defined or imported

  • Microsoft (R) Visual C# Interactive Compiler version 2.0.0.61404
    (1,1): error CS8179: Predefined type 'System.ValueTuple`2' is not defined or imported
    (1,1): error CS0029: Cannot implicitly convert type '(string, int)' to 'object'

Workaround

  • Microsoft Visual Studio Enterprise 2017 RC 15.9.9-RC4+26206.0

Remove

/r:System.ValueTuple.dll

From

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\ManagedLanguages\VBCSharp\InteractiveComponents\CSharpInteractive.rsp
  • Microsoft (R) Visual C# Interactive Compiler version 2.0.0.61404

Remove

/r:System.ValueTuple.dll

From

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csi.rsp
@tmat
Copy link
Member

tmat commented Feb 15, 2017

The important piece of information here is that the machine has a pre-release version of .NET Framework 4.7

@paulomorgado
Copy link
Author

Or, if you think as a customer, the customer installed VS2017 and tuples don't work on interactive environments.

Isn't .NET Framework 4.7 a requirement of VS2017? I sure didn't explicitly install it.

@tmat
Copy link
Member

tmat commented Feb 15, 2017

It is not. Windows Insider update would install it.

@paulomorgado
Copy link
Author

OK!

I've noticed that, although the interactive uses the mscorlib ValueTuple, in projects (.NET Framework or .NET Core), the System.ValueTuple package is required.

@jcouv
Copy link
Member

jcouv commented Feb 24, 2017

Fixed by #17192 (this let the EE and Interactive handle the duplicate ValueTuple type and pick the one from the app instead of the one from mscorlib).
I expect the fix to make it into 15.3 (summer timeframe, based on my understanding).

There will also be a follow-up to have GAC type unification, so the compiler workaround isn't needed (targeting desktop 4.7.1 framework).

@jcouv jcouv closed this as completed Feb 24, 2017
@jcouv jcouv self-assigned this Feb 24, 2017
@paulomorgado
Copy link
Author

@jcouv, does "summer timeframe" mean that the problem will be in VS2017RTM?

@jcouv
Copy link
Member

jcouv commented Feb 24, 2017

Yes. At this point RTM has a very high bar for accepting fixes (crashes and such). So this fix didn't make it into RTM. Sorry about that.

@paulomorgado
Copy link
Author

At least, make that noticeable in the release notes and release a script to fix .rsp files.

@jcouv jcouv changed the title C# Interactive doesn't work with tuple syntax. C# Interactive doesn't work with tuple syntax when desktop framework 4.7 is installed Feb 25, 2017
EamonNerbonne added a commit to EamonNerbonne/ValueUtils that referenced this issue May 5, 2017
Seems to be related to:dotnet/roslyn#17157 - I'm guessing I should ignore this and let the dust settle first.
@thomaslevesque
Copy link
Member

I just hit the same issue. @paulomorgado's fix doesn't seem to work for me, I still get the same error.

@paulomorgado
Copy link
Author

Run this:

Get-ChildItem -LiteralPath 'C:\Program Files (x86)\Microsoft Visual Studio\' -Filter '*.rsp' -Recurse | Select-String -SimpleMatch '/r:System.ValueTuple.dll'

You'll see which rsp files have the reference.

@thomaslevesque
Copy link
Member

Thanks @paulomorgado, that was it. I had a csi.rsp in C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csi.rsp

@paulomorgado
Copy link
Author

Beware of any VS updates. I think it will "repair" that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants