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

Broken when referencing a Nuget package in F# interactive #452

Open
omcnoe opened this issue Sep 12, 2023 · 21 comments
Open

Broken when referencing a Nuget package in F# interactive #452

omcnoe opened this issue Sep 12, 2023 · 21 comments
Labels
question Further information is requested

Comments

@omcnoe
Copy link

omcnoe commented Sep 12, 2023

In my global Nuget config I have a source that requires authentication.
I've authenticated for this source before. dotnet restore works fine and can access packages from this source.

But in F# interactive (fsx script or console) all Nuget package commands like #r "nuget: Microsoft.ABC fail (even for packages that aren't from the problematic source).

Error message:
/Users/omcnoe/stdin(1,1): error FS3217: /usr/local/share/dotnet/sdk/7.0.306/NuGet.targets(156,5): warning : The plugin credential provider could not acquire credentials. Authentication may require manual action. Consider re-running the command with --interactive for 'dotnet', /p:NuGetInteractive="true" for MSBuild or removing the -NonInteractive switch for 'NuGet' [/Users/omcnoe/.packagemanagement/nuget/Projects/--SNIP--/Project.fsproj]

Unlike the error message suggests, dotnet fsi --interactive or dotnet --interactive fsi are not valid commands

@embetten
Copy link
Contributor

embetten commented Sep 12, 2023

The dotnet restore command is typically for restoring .csproj files and supports the interactive flag. dotnet fsi is a completely different command and does not look like it supports the --interactive flag (see docs). So the first part of the cred provider error message to use --interactive for 'dotnet' is not applicable in the f# context. However, it looks like this part of the message: or removing -NonInteractive switch for 'NuGet' [/Users/omcnoe/.packagemanagement/nuget/Projects/--SNIP--/Project.fsproj] might be the correct action for f# projects.

Let me know if this resolves the issue.

@embetten embetten added the question Further information is requested label Sep 12, 2023
@omcnoe
Copy link
Author

omcnoe commented Sep 12, 2023

--interactive is relevant for dotnet restore in an .fsproj or .csproj project.

That project file named in the error message isn't my project file - a new random project file is created each time you run dotnet fsi. dotnet fsi is failing to be authenticated with the Nuget source, even though I'm already authenticated - I can access the source in other projects with dotnet restore and don't need to re-authenticate.

The authentication plugin is broken under F# interactive mode - at least for me.
I think it's actually a bug.

@embetten
Copy link
Contributor

embetten commented Sep 19, 2023

Can you give more details on where you are running dotnet fsi? Visual Studio and version?

I am able to authenticate and install from an Azure Artifacts feed with dotnet fsi and the cred provider (using the #i and#r commands). This worked in both polygot notebooks, the latest version of Visual Studio, and in Visual studio code. I did find authentication did not work with an older version of visual studio and it looks like VS has a couple of open issues tracking this.

@omcnoe
Copy link
Author

omcnoe commented Sep 20, 2023

I'm on macOS. Using the dotnet sdk installed directly from https://dotnet.microsoft.com/en-us/download

I had sdk 7.0.306, I updated to latest sdk 7.0.401 and it is still not working correctly, still getting same message.

@omcnoe
Copy link
Author

omcnoe commented Sep 20, 2023

I'm running dotnet fsi directly from command line

@embetten
Copy link
Contributor

@omcnoe I was able to repro the issue on a MacOS and spoke with a dev on the f# side. TL;DR this is an issue on the f# side not supporting interactive mode when it calls nuget (msbuild) under the hood. I have created a feature request on their repo.

On my machine running dotnet restore -interactive before dotnet fsi did not require me to reauthenticate and I was able to restore from fsi. From your comments it sounds like this does not work for you? If so, can you ensure you have the most recent version of the cred provider there were some updates to the cache location.

@omcnoe
Copy link
Author

omcnoe commented Oct 2, 2023

I believe I have the most recent version, but I'm not sure. Is the update process just "run the install again"?

@embetten
Copy link
Contributor

embetten commented Oct 2, 2023

Yes, we have an install script for macs to make it easy here. Let me know if this does not resolve the issue.

@phil-hodgson
Copy link
Member

@omcnoe Any success with the latest version?

@omcnoe
Copy link
Author

omcnoe commented Nov 27, 2023

@phil-hodgson no, same exact behavior as before

I think the mention of "interactive mode" in the error message is just a red herring.
I am already authenticated with this nuget source - dotnet restore elsewhere doesn't require me to re-authenticate.

Shouldn't artifacts-credprovider pick up and use this existing auth?
I don't need to re-authenticate using interactive mode inside dotnet fsi - it just has to correctly use whatever existing auth token has already been setup.

@johnterickson
Copy link
Contributor

I don't use F# but if this uses the same underlying msbuild logic then you should be anle to pass in /p:NuGetInteractive=true.

@omcnoe
Copy link
Author

omcnoe commented Dec 15, 2023

Hi John, sadly dotnet fsi does not accept that parameter.

Please see the above comment about NuGet "interactive mode" in the error message being a red herring.
I have already authenticated with the nuget source. Other commands like dotnet build that use packages from this source already work fine without requiring me to re-authenticate again.

The problem is that when used by fsi the credential provider is not picking up my existing authentication.

@johnterickson
Copy link
Contributor

Is this related? dotnet/fsharp#10609

Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale.

@github-actions github-actions bot added the stale This hasn't had any recent activity label Mar 19, 2024
@omcnoe
Copy link
Author

omcnoe commented Mar 19, 2024

Yes issue is still present.

@github-actions github-actions bot removed the stale This hasn't had any recent activity label Mar 20, 2024
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale.

@github-actions github-actions bot added the stale This hasn't had any recent activity label Jun 18, 2024
@omcnoe
Copy link
Author

omcnoe commented Jun 18, 2024

This issue still exists.

@github-actions github-actions bot removed the stale This hasn't had any recent activity label Jun 18, 2024
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale.

@github-actions github-actions bot added the stale This hasn't had any recent activity label Sep 16, 2024
@omcnoe
Copy link
Author

omcnoe commented Sep 16, 2024

Still present

@github-actions github-actions bot removed the stale This hasn't had any recent activity label Sep 17, 2024
Copy link

This issue has had no activity in 90 days. Please comment if it is not actually stale.

@github-actions github-actions bot added the stale This hasn't had any recent activity label Dec 16, 2024
@omcnoe
Copy link
Author

omcnoe commented Dec 17, 2024

Yes issue is still present.

@github-actions github-actions bot removed the stale This hasn't had any recent activity label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants