NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

dotnet build/restore/run is not working #13717

Closed SoyDiego closed 2 months ago

SoyDiego commented 2 months ago

NuGet Product Used

Other/NA

Product Version

8.0.107

Worked before?

No response

Impact

I'm unable to use this version

Repro Steps & Context

Hi I was running my project using dotnet run and downloading the nugets from Azure doing dotnet restore --interactive but today I found some problems and I don't know what is happening...

image

After that command nothing is happening. And If I cancel the command I'm receiving this warnings:

image

After 10 minutes, you can see this errors:

 Determining projects to restore...
/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Data/CitizenPortal.Data.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Api.sln]
/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Services/CitizenPortal.Services.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Api.sln]
/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Common.Data/CitizenPortal.Common.Data.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Api.sln]
/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Api/CitizenPortal.Api.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Api.sln]
/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Tests/CitizenPortal.Tests.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Api.sln]
/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Crosscutting/CitizenPortal.Crosscutting.csproj : error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json. [/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Api.sln]
  Failed to restore /home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Common.Data/CitizenPortal.Common.Data.csproj (in 10.09 min).
  Failed to restore /home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Crosscutting/CitizenPortal.Crosscutting.csproj (in 10.09 min).
  Failed to restore /home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Services/CitizenPortal.Services.csproj (in 10.09 min).
  Failed to restore /home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Api/CitizenPortal.Api.csproj (in 10.09 min).
  Failed to restore /home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Data/CitizenPortal.Data.csproj (in 10.09 min).

dotnet restore --interactive -v detailed (I'm using Artifacts Credential Provider) :

I have created a gist because was too long and I couldn't share pasting here: https://gist.github.com/SoyDiego/8cfc7fa94f4da76ceb8c44a2f30fc9f2

I don't know what more I can try.

Because is with every commmand:

I have tried:

dotnet info

.NET SDK:
 Version:           8.0.107
 Commit:            1bdaef7265
 Workload version:  8.0.100-manifests.43c23f91

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/8.0.107/

.NET workloads installed:
 Workload version: 8.0.100-manifests.43c23f91
There are no installed workloads to display.

Host:
  Version:      8.0.7
  Architecture: x64
  Commit:       2aade6beb0

.NET SDKs installed:
  3.1.426 [/usr/share/dotnet/sdk]
  7.0.120 [/usr/share/dotnet/sdk]
  8.0.107 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.32 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.32 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Any help here or someone with the same problem? Or any idea what more can I try, please?

Thanks!!

Verbose Logs

No response

baronfel commented 2 months ago

I believe this may be a duplicate of https://github.com/NuGet/Home/issues/13644

SoyDiego commented 2 months ago

I believe this is a duplicate of #13644

Are you sure? I don't know and my knowdlege in .NET is not high but it is possible for this problem I cannot get access to my artifacts?

Thanks again for reply @baronfel and I hope someone have a solution or workaround

nkolev92 commented 2 months ago

Hey @SoyDiego

Seems like your machine is having trouble connecting to the network. Are you using any proxy by any chance? Any sort of firewall restricting access?

@baronfel is likely correct about the cancellation not working, but there might be more to your issues than the cancellation issue.

To help drive the direction of this investigation, can you please just run dotnet restore with -p:NuGetAudit=false. That'll tell us whether the http calls are coming from the audit part only or if it's general.

SoyDiego commented 2 months ago

Hey @SoyDiego

Seems like your machine is having trouble connecting to the network. Are you using any proxy by any chance? Any sort of firewall restricting access?

@baronfel is likely correct about the cancellation not working, but there might be more to your issues than the cancellation issue.

To help drive the direction of this investigation, can you please just run dotnet restore with -p:NuGetAudit=false. That'll tell us whether the http calls are coming from the audit part only or if it's general.

Hi @nkolev92 thanks for reply. No, I'm not using firewall and nothing. I didn't change anything also in My Organization in Azure. It's very weird. I'm in linux and in this moment I reinstalled my projects and also I installed older versions of dotnet (8.0.6) because was working there and I was thinking maybe an update broke this part. But I had not luck.

Right now I'm in this version and I continue with the same problem and I cannot run my projects:

dotnet --info                                                                                                                                                                                                                                                                                                                         ✔ 
.NET SDK:
 Version:           8.0.302
 Commit:            ef14e02af8
 Workload version:  8.0.300-manifests.c915c39d
 MSBuild version:   17.10.4+10fbfbf2e

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/8.0.302/

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      8.0.6
  Architecture: x64
  Commit:       3b8b000a0e

.NET SDKs installed:
  3.1.426 [/usr/share/dotnet/sdk]
  7.0.120 [/usr/share/dotnet/sdk]
  8.0.302 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.32 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.32 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/share/dotnet]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Also I changed my Personal Access Token of Azure Devops but nothing. If I enter with the browser I have access to my artifacts but It's like is not possible with the Visual Studio Code. 2 weeks ago all was running perfectly and I'm using Azure Credential Provider. I wrote a issue there too asking if the problem is for them. But they said no.

I don't know what more I can try. The project is working to my colleagues (Windows Users) and we verified git and the source code and we didn't change nothing.

I hope someone can help with any idea or workaround. I reinstalled and installed different version of dotnet and trying a lot of things for3 days with no luck! :(

nkolev92 commented 2 months ago

Can you try dotnet restore -p:NuGetAudit=false and report back what you see?

SoyDiego commented 2 months ago

dotnet restore -p:NuGetAudit=false

Hi @nkolev92 thanks again for reply.

Same problem, frozen for a looong time (10 min):

image

image

And at the end show the same message.

Also I did dotnet restore -p:NuGetAudit=false --verbosity detailed and I filtered by error:

Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.SDK.WorkloadAutoImportPropsLocator" because directory "/usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.SDK.WorkloadAutoImportPropsLocator/Sdk" did not exist.                                                                                                
         Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.SDK.WorkloadManifestTargetsLocator" because directory "/usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.SDK.WorkloadManifestTargetsLocator/Sdk" did not exist.                                                                                                
         Property reassignment: $(WarningsAsErrors)=";NU1605;SYSLIB0011" (previous value: ";NU1605") at /usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.CSharp.targets (48,5)                                                                                                                                          
         Property reassignment: $(WarningsAsErrors)=";NU1605;SYSLIB0011" (previous value: ";NU1605") at /usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.CSharp.targets (48,5)                                                                                                                                          
         Property reassignment: $(WarningsAsErrors)=";NU1605;SYSLIB0011" (previous value: ";NU1605") at /usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.CSharp.targets (48,5)                                                                                                                                          
         Property reassignment: $(WarningsAsErrors)=";NU1605;SYSLIB0011" (previous value: ";NU1605") at /usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.CSharp.targets (48,5)                                                                                                                                          
         Task "NETSdkError" skipped, due to false condition; ('$(_TargetFrameworkVersionWithoutV)' > '$(NETCoreAppMaximumVersion)' and '$(DisplayVSMessage)' != 'true') was evaluated as ('8.0' > '8.0' and '' != 'true').                                                                                                                            
         Task "NETSdkError" skipped, due to false condition; ('$(DisplayVSMessage)' == 'true') was evaluated as ('' == 'true').                                                                                                                                                                                                                       
         Task "NETSdkError" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(_TargetFrameworkVersionWithoutV)' < '3.1' and ('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true')) was evaluated as ('.NETCoreApp' == '.NETCoreApp' and '8.0' < '3.1' and ('C#' == 'C++' and '' !.. 
         Task "NETSdkError" skipped, due to false condition; ('$(_TargetFrameworkVersionWithoutV)' > '$(NETCoreAppMaximumVersion)' and '$(DisplayVSMessage)' != 'true') was evaluated as ('8.0' > '8.0' and '' != 'true').                                                                                                                            
         Task "NETSdkError" skipped, due to false condition; ('$(DisplayVSMessage)' == 'true') was evaluated as ('' == 'true').                                                                                                                                                                                                                       
         Task "NETSdkError" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(_TargetFrameworkVersionWithoutV)' < '3.1' and ('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true')) was evaluated as ('.NETCoreApp' == '.NETCoreApp' and '8.0' < '3.1' and ('C#' == 'C++' and '' !.. 
         Task "NETSdkError" skipped, due to false condition; ('$(_ShouldRemoveAspNetCoreAll)' == 'true') was evaluated as ('False' == 'true').                                                                                                                                                                                                        
         Task "NETSdkError" skipped, due to false condition; ('$(_ShouldRemoveAspNetCoreAll)' == 'true') was evaluated as ('False' == 'true').                                                                                                                                                                                                        
         Task "NETSdkError" skipped, due to false condition; (('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true') and $(OutputType) != 'library' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp') was evaluated as (('C#' == 'C++' and '' != 'true') and Library != 'library' and '.NETCoreApp' == '.NETCoreApp').   
         Task "NETSdkError" skipped, due to false condition; (('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true') and $(EnableComHosting) == 'true') was evaluated as (('C#' == 'C++' and '' != 'true') and  == 'true').                                                                                                 
         Task "NETSdkError" skipped, due to false condition; (('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true') and $(SelfContained) == 'true') was evaluated as (('C#' == 'C++' and '' != 'true') and  == 'true').                                                                                                    
         Task "NETSdkError" skipped, due to false condition; (('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true') and $(OutputType) != 'library' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp') was evaluated as (('C#' == 'C++' and '' != 'true') and Library != 'library' and '.NETCoreApp' == '.NETCoreApp').   
         Task "NETSdkError" skipped, due to false condition; (('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true') and $(EnableComHosting) == 'true') was evaluated as (('C#' == 'C++' and '' != 'true') and  == 'true').                                                                                                 
         Task "NETSdkError" skipped, due to false condition; (('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true') and $(SelfContained) == 'true') was evaluated as (('C#' == 'C++' and '' != 'true') and  == 'true').                                                                                                    
         Task "NETSdkError" skipped, due to false condition; ('$(_TargetFrameworkVersionWithoutV)' > '$(NETCoreAppMaximumVersion)' and '$(DisplayVSMessage)' != 'true') was evaluated as ('8.0' > '8.0' and '' != 'true').                                                                                                                            
         Task "NETSdkError" skipped, due to false condition; ('$(DisplayVSMessage)' == 'true') was evaluated as ('' == 'true').                                                                                                                                                                                                                       
         Task "NETSdkError" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(_TargetFrameworkVersionWithoutV)' < '3.1' and ('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true')) was evaluated as ('.NETCoreApp' == '.NETCoreApp' and '8.0' < '3.1' and ('C#' == 'C++' and '' !.. 
         Task "NETSdkError" skipped, due to false condition; ('$(_ShouldRemoveAspNetCoreAll)' == 'true') was evaluated as ('False' == 'true').                                                                                                                                                                                                        
         Task "NETSdkError" skipped, due to false condition; (('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true') and $(OutputType) != 'library' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp') was evaluated as (('C#' == 'C++' and '' != 'true') and Library != 'library' and '.NETCoreApp' == '.NETCoreApp').   
         Task "NETSdkError" skipped, due to false condition; (('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true') and $(EnableComHosting) == 'true') was evaluated as (('C#' == 'C++' and '' != 'true') and  == 'true').                                                                                                 
         Task "NETSdkError" skipped, due to false condition; (('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true') and $(SelfContained) == 'true') was evaluated as (('C#' == 'C++' and '' != 'true') and  == 'true').                                                                                                    
         Target "_CheckForUnsupportedTargetFramework" skipped, due to false condition; ('$(_UnsupportedTargetFrameworkError)' == 'true') was evaluated as ('' == 'true').                                                                                                                                                                             
         Task "NETSdkError" skipped, due to false condition; ('$(_TargetFrameworkVersionWithoutV)' > '$(NETCoreAppMaximumVersion)' and '$(DisplayVSMessage)' != 'true') was evaluated as ('8.0' > '8.0' and '' != 'true').                                                                                                                            
         Task "NETSdkError" skipped, due to false condition; ('$(DisplayVSMessage)' == 'true') was evaluated as ('' == 'true').                                                                                                                                                                                                                       
>        Task "NETSdkError" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(_TargetFrameworkVersionWithoutV)' < '3.1' and ('$(Language)' == 'C++' and '$(_EnablePackageReferencesInVCProjects)' != 'true')) was evaluated as ('.NETCoreApp' == '.NETCoreApp' and '8.0' < '3.1' and ('C#' == 'C++' and '' !.

If you see, in the first lines you can see:

Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.SDK.WorkloadAutoImportPropsLocator" because directory "/usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.SDK.WorkloadAutoImportPropsLocator/Sdk" did not exist.                                                                                                
         Errors: MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.SDK.WorkloadManifestTargetsLocator" because directory "/usr/share/dotnet/sdk/8.0.302/Sdks/Microsoft.NET.SDK.WorkloadManifestTargetsLocator/Sdk" did not exist.           

But I think this is not relevant, and it's showing this message because I downgraded to version 8.0.6 with SDK 8.0.132. When I was using the latest version (8.0.8), I didn't see this message, but the problem continued without any errors.

If there are more things to try or check, please let me know. I'm desperate to solve this problem or find a workaround.

Thanks again for your time and help @nkolev92!

nkolev92 commented 2 months ago

Seems to primarily be a network problem.

The 10 min matches the timeouts.

I'm guessing you can access the url?

zivkan commented 2 months ago

@SoyDiego try going to a directory with a csproj, and run dotnet add package DoesNotExist. it should show the inner exception, and therefore give more context about why the service index couldn't be downloaded.

You can also try using wget or curl to download the same URL, to test if it's something fundamental to your machine's networking, or if it's specific to .NET. If you get an HTTP 401 error, then that's fine, it at least means that your machine was able to connect to the server.

You can also do dotnet new console to create a console app, and use await new HttpClient().GetAsync(args[0]); to test if you'd like to verify NuGet working differently to different .NET apps. You'll probably need to build this test app with dotnet build -p:NuGetAudit=false, or set NuGetAudit=false as an environment variable, but using the HTTP client in .NET (CoreApp) projects doesn't need any packages, so restore should work even if networking isn't working.

SoyDiego commented 2 months ago

Seems to primarily be a network problem.

The 10 min matches the timeouts.

I'm guessing you can access the url?

Thanks again @nkolev92 to be here. Yes, from the browser I can access to the url and I can see perfectly the .json of my Azure Devops for that reason it's weird. I have access. And like I said in my first post, to get the nugets I'm using Azure Artifacts Credential Provider.

@SoyDiego try going to a directory with a csproj, and run dotnet add package DoesNotExist. it should show the inner exception, and therefore give more context about why the service index couldn't be downloaded.

Hi @zivkan, thanks for help and give more ideas :)

dotnet add package DoesNotExist:

  ~/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Api/ dotnet add package DoesNotExist                                                                                                                                                                                                                            
  Determining projects to restore...
  Writing /tmp/tmpmCLHUM.tmp
info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/share/dotnet/sdk/8.0.302/trustedroots/codesignctl.pem'.
info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/share/dotnet/sdk/8.0.302/trustedroots/timestampctl.pem'.
info : Adding PackageReference for package 'DoesNotExist' into project '/home/diego/Repos/CitizenPortal/CitizenPortalApi/CitizenPortal.Api/CitizenPortal.Api.csproj'.
info :   GET https://api.nuget.org/v3/registration5-gz-semver2/doesnotexist/index.json
info :   NotFound https://api.nuget.org/v3/registration5-gz-semver2/doesnotexist/index.json 489ms

Using wget [my url]

--2024-08-20 08:14:04--  https://convidad.pkgs.visualstudio.com/Utils/_packaging/Convidad.Encryption/nuget/v3/index.json
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving convidad.pkgs.visualstudio.com (convidad.pkgs.visualstudio.com)... 2620:1ec:21::18, 13.107.42.18
Connecting to convidad.pkgs.visualstudio.com (convidad.pkgs.visualstudio.com)|2620:1ec:21::18|:443... failed: Connection timed out.
Connecting to convidad.pkgs.visualstudio.com (convidad.pkgs.visualstudio.com)|13.107.42.18|:443... connected.
HTTP request sent, awaiting response... 401 Unauthorized

Username/Password Authentication Failed.

Using curl

curl -v https://convidad.pkgs.visualstudio.com/Utils/_packaging/Convidad.Encryption/nuget/v3/index.json                                                                                                                                        6 ✘  2m 14s   

* Host convidad.pkgs.visualstudio.com:443 was resolved.
* IPv6: 2620:1ec:21::18
* IPv4: 13.107.42.18
*   Trying [2620:1ec:21::18]:443...
*   Trying 13.107.42.18:443...
* Connected to convidad.pkgs.visualstudio.com (13.107.42.18) port 443
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: none
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / secp521r1 / RSASSA-PSS
* ALPN: server accepted h2
* Server certificate:
*  subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; CN=visualstudio.com
*  start date: Jun 17 05:29:33 2024 GMT
*  expire date: Dec 14 05:29:33 2024 GMT
*  subjectAltName: host "convidad.pkgs.visualstudio.com" matched cert's "*.pkgs.visualstudio.com"
*  issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure RSA TLS Issuing CA 03
*  SSL certificate verify ok.
*   Certificate level 0: Public key type RSA (2048/112 Bits/secBits), signed using sha384WithRSAEncryption
*   Certificate level 1: Public key type RSA (4096/152 Bits/secBits), signed using sha384WithRSAEncryption
*   Certificate level 2: Public key type RSA (2048/112 Bits/secBits), signed using sha256WithRSAEncryption
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://convidad.pkgs.visualstudio.com/Utils/_packaging/Convidad.Encryption/nuget/v3/index.json
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: convidad.pkgs.visualstudio.com]
* [HTTP/2] [1] [:path: /Utils/_packaging/Convidad.Encryption/nuget/v3/index.json]
* [HTTP/2] [1] [user-agent: curl/8.9.1]
* [HTTP/2] [1] [accept: */*]
> GET /Utils/_packaging/Convidad.Encryption/nuget/v3/index.json HTTP/2
> Host: convidad.pkgs.visualstudio.com
> User-Agent: curl/8.9.1
> Accept: */*
> 
* Request completely sent off
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 401 
< cache-control: no-cache
< pragma: no-cache
< content-length: 343
< content-type: application/json; charset=utf-8
< expires: -1
< p3p: CP="CAO DSP COR ADMa DEV CONo TELo CUR PSA PSD TAI IVDo OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR LOC CNT"
< www-authenticate: Basic realm="https://pkgsprodsu3weu.app.pkgs.visualstudio.com/"
< www-authenticate: Bearer
< www-authenticate: TFS-Federated
< x-tfs-processid: 124a7acb-7c42-4522-a419-2b29c41c520a
< strict-transport-security: max-age=31536000; includeSubDomains
< activityid: f8e8df5e-8536-4dd2-9639-f3a5bb809f95
< x-tfs-session: f8e8df5e-8536-4dd2-9639-f3a5bb809f95
< x-vss-e2eid: f8e8df5e-8536-4dd2-9639-f3a5bb809f95
< x-vss-senderdeploymentid: 1a640fd9-ac39-bf02-92ac-d7705ca2547a
< x-frame-options: SAMEORIGIN
< x-tfs-fedauthrealm: https://pkgsprodsu3weu.app.pkgs.visualstudio.com/
< x-tfs-fedauthissuer: https://www.visualstudio.com/
< x-vss-authorizationendpoint: https://convidad.vssps.visualstudio.com/
< x-vss-resourcetenant: 00000000-0000-0000-0000-000000000000
< x-vss-s2stargetservice: 00000030-0000-8888-8000-000000000000/visualstudio.com
< x-tfs-fedauthredirect: https://spsprodweu4.vssps.visualstudio.com/_signin?realm=convidad.pkgs.visualstudio.com&reply_to=https%3A%2F%2Fconvidad.pkgs.visualstudio.com%2FUtils%2F_packaging%2FConvidad.Encryption%2Fnuget%2Fv3%2Findex.json&redirect=1&hid=d1ae3523-74ed-4d40-bcd1-bf56aca627cf&context=eyJodCI6MiwiaGlkIjoiODViZGU2MTMtMzJiNy00NWY0LTgxNzQtYTZlNzBlZDhiNTdhIiwicXMiOnt9LCJyciI6IiIsInZoIjoiIiwiY3YiOiIiLCJjcyI6IiJ90#ctx=eyJTaWduSW5Db29raWVEb21haW5zIjpbImh0dHBzOi8vbG9naW4ud2luZG93cy5uZXQiXX01
< request-context: appId=cid-v1:f5d75a35-28cc-4e72-8007-1cf59e01402f
< access-control-expose-headers: Request-Context
< x-content-type-options: nosniff
< x-cache: CONFIG_NOCACHE
< x-msedge-ref: Ref A: C4F37DE17E204BCB992CD3EA46BF064C Ref B: MAD30EDGE0816 Ref C: 2024-08-20T06:18:21Z
< date: Tue, 20 Aug 2024 06:18:21 GMT
< 
* Connection #0 to host convidad.pkgs.visualstudio.com left intact
{"$id":"1","innerException":null,"message":"TF400813: The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource.","typeName":"Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException, Microsoft.TeamFoundation.Framework.Server","typeKey":"UnauthorizedRequestException","errorCode":0,"eventId":3000}

Creating console app

image

If I wrote or did something wrong, let me know.

I can see in the curl and wget I cannot have access. This means like Azure Credential Provider is not working ok? Sorry if my questions are basic. And thanks again for try to help I will be here to reply what you need.

zivkan commented 2 months ago

My first comment is that I'm surprised that the dotnet add package test didn't have the same "could not load service index" error that was reported in the first post in this issue. The first post said that https://api.nuget.org/v3/index.json couldn't be fetched, but the dotnet add package output shows the expected output for when the service index was successfully downloaded.

However, the other tests show an issue. wget's logs shows it tried an IPv6 address, failed, then tried the IPv4 address, which worked. curl's output shows it tried a IPv4 address, it doesn't explicitly say that it failed, but then it tries the IPv4 address. The .NET console app test is consistent with .NET trying the IPv6 address and timing out without falling back to IPv4, although more logging would be needed to confirm for sure.

So, my best guess is that there's something wrong with your IPv6 networking. This is outside the scope of NuGet, so I'm unable to help with that. But if you were to disable IPv6, I suspect that NuGet would start working. You might not want to disable IPv6 for other reasons, but it could be a workaround until you find out how to fix IPv6 on your network/computer.

My best guess as to why api.nuget.org didn't work before and did work this time, NuGet is behind two different CDNs, and it might be that one of them uses IPv6 and the other one does not. I don't know why it would try different CDNs at different times, but if you have the problem again, you can run nslookup api.nuget.org, or host api.nuget.org, to see what IP addresses it's resolving to at the time that

SoyDiego commented 2 months ago

My first comment is that I'm surprised that the dotnet add package test didn't have the same "could not load service index" error that was reported in the first post in this issue. The first post said that https://api.nuget.org/v3/index.json couldn't be fetched, but the dotnet add package output shows the expected output for when the service index was successfully downloaded.

However, the other tests show an issue. wget's logs shows it tried an IPv6 address, failed, then tried the IPv4 address, which worked. curl's output shows it tried a IPv4 address, it doesn't explicitly say that it failed, but then it tries the IPv4 address. The .NET console app test is consistent with .NET trying the IPv6 address and timing out without falling back to IPv4, although more logging would be needed to confirm for sure.

So, my best guess is that there's something wrong with your IPv6 networking. This is outside the scope of NuGet, so I'm unable to help with that. But if you were to disable IPv6, I suspect that NuGet would start working. You might not want to disable IPv6 for other reasons, but it could be a workaround until you find out how to fix IPv6 on your network/computer.

My best guess as to why api.nuget.org didn't work before and did work this time, NuGet is behind two different CDNs, and it might be that one of them uses IPv6 and the other one does not. I don't know why it would try different CDNs at different times, but if you have the problem again, you can run nslookup api.nuget.org, or host api.nuget.org, to see what IP addresses it's resolving to at the time that

Hi @zivkan thanks again for your ideas.

I recently purchased a WiFi Mesh. , but I am connected via ethernet. When you mentioned IPv6, the first thing I checked was if there was any incorrect configuration.

To my surprise, IPv6 is disabled, and I am using IPv4. So, honestly, I don't know what else to try or do.

Here the settings of the Wifi Mesh:

image

image

Any other idea?

SoyDiego commented 2 months ago

I got this information doing ip addr:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: enp58s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b0:25:aa:5b:25:74 brd ff:ff:ff:ff:ff:ff
    inet 192.168.68.70/22 brd 192.168.71.255 scope global dynamic noprefixroute enp58s0
       valid_lft 4510sec preferred_lft 4510sec
    inet6 2a02:9003:a7:9eba::33/128 scope global dynamic noprefixroute 
       valid_lft 36915sec preferred_lft 36915sec
    inet6 fe80::eca1:6eb9:d659:953c/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlo1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether e6:6d:5b:9c:f8:19 brd ff:ff:ff:ff:ff:ff permaddr f4:3b:d8:2a:49:73
    altname wlp0s20f3
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:42:76:e4:25 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

So if i'm not wrong, i'm using IPv6 here: I didn't do nothing, and now i'm afraid if I remove something, have internet problems in my home

2. Interface enp58s0 (Wired connection):

    IPv4: 192.168.68.70/22
    IPv6: You have two IPv6 addresses assigned:
        Global: 2a02:9003:a7:9eba::33/128
        Link-local: fe80::eca1:6eb9:d659:953c/64
SoyDiego commented 2 months ago

Hi, I finally solved the problem, and it's very, very, very weird. When @zivkan mentioned IPv6, I reviewed the information in my last comment and thought, "Ok, I’ll try using Wi-Fi and disconnect the Ethernet." To my surprise, when I did dotnet restore --interactive, everything worked perfectly, and I could run my project again 🥳.

After that, I decided to switch back to Ethernet and disconnect the Wi-Fi to see what would happen. To my surprise, everything is still working perfectly, and the commands are running fine. I also tried with another project where I had problems, and yes, it's still working, and NuGet packages are downloading. It's like something was "stuck" or something like that...

But thanks again to both of you, especially @zivkan, because with your ideas, we were able to solve the problem.