interactive icon indicating copy to clipboard operation
interactive copied to clipboard

#r nuget directive - strange side effects with Visual Studio Nuget Package Manager

Open JDiLenarda opened this issue 3 years ago • 1 comments

Describe the bug

In the Visual Studio (2019 or 2022) Nuget package manager, add 2 sources :

C:\nuget\rihanna C:\nuget\beyoncé

Create the underlying directories as well.

In Visual Studio Code :

  • create a .NET Interactive Notebooks
  • add a C# or F# code cell
  • type #r "nuget: Newtonsoft.Json" and execute You will get : stdin(1,1): error FS3217: The source directory 'C:\Nuget\beyonc%EF%BF%BD' not found

Notes :

  • the package that is tried to be loaded is not supposed to be in any local source directory.
  • you get the error even if the faulty source is unticked in the package manager. The only workaround is to remove it.

I first noticed this bug in F# Interactive a few months back : https://github.com/dotnet/fsharp/issues/12401. I only realized it was impacting .NET Interactive last week. I filed thid issue on Nuget repo: https://github.com/NuGet/Home/issues/11955. I've been suggested to report it here.

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

.NET Interactive notebooks v1.0.3314011

  • OS
    • [ ] Windows 11
    • [x] Windows 10
    • [ ] macOS
    • [ ] Linux (Please specify distro)
    • [ ] iOS
    • [ ] Android
  • Frontend
    • [ ] Jupyter Notebook
    • [ ] Jupyter Lab
    • [ ] nteract
    • [x] Visual Studio Code: 1.69.0
    • [ ] Visual Studio Code Insiders
    • [x] Visual Studio: 2019 (16.11.6)
    • [x] Other : Nuget Package Manager 5.11.0

JDiLenarda avatar Jul 13 '22 13:07 JDiLenarda

Related to: https://github.com/dotnet/csharp-notebooks/issues/60

JakeRadMSFT avatar Jul 18 '22 20:07 JakeRadMSFT

I'm upset because I want to push for .NET Interactive use in my company, but this bug is in the way.

I investigated a bit, and it appears that the Nuget repository paths are in a Nuget.Config file sit in %appdata%\NuGet on Windows 10. The path are stored like this :

<add key="My repository" value="c:\Beyoncé" />

I get my error if this key is present, and not if removed or commented. So at one point, those paths are retrieved, but probably read with a bad encoding. But where ? Or since you marked the issue as external, by what, so I know where to file an issue ?

(notice that the 0xEFBFBD code in the stdin(1,1): error FS3217: The source directory 'C:\Nuget\beyonc%EF%BF%BD' not found message is the replacement character �).

JDiLenarda avatar Sep 23 '22 13:09 JDiLenarda

The related issue in F# Interactive dotnet/fsharp#12401 is corrected, incidentally correcting this one.

JDiLenarda avatar Nov 20 '22 16:11 JDiLenarda