Home: Error occurred trying to view packages on nuget.org in VS2015

Created on 3 Mar 2016  路  9Comments  路  Source: NuGet/Home

Steps to reproduce

  • Right click Solution
  • Select Manage Nuget Packages for Solution...
  • "Manage Packages for Solution" window appears.

A list of packages on the nuget.org site is displayed.

Actual

Error occured:\nThe input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

nugetbug

Other things tried

  • Reboot
  • Restart VS
  • Uninstall/reinstall

    Additional

I have used nuget on this environment before, but a number of days ago. I have no other extensions installed except those directly installed with Visual Studio.

Environment Information

Windows 10, Using VS2015 Update 1, occurs in .NET 5 and .NET Core apps.

Nuget: v3.3.0.167 (there are no updated available)

My Nuget.Config (default as far as I know):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <!-- 
    Used to specify the default location to expand packages.
    See: NuGet.exe help install
    See: NuGet.exe help update
    -->
    <add key="repositoryPath" value="External\Packages" />
    <!-- 
    Used to specify default source for the push command.
    See: NuGet.exe help push
    -->
    <add key="DefaultPushSource" value="http://MyRepo/ES/api/v2/package" />
    <!-- 
    Proxy settings
    -->
    <add key="http_proxy" value="host" />
    <add key="http_proxy.user" value="username" />
    <add key="http_proxy.password" value="encrypted_password" />
  </config>
  <packageRestore>
    <!-- Allow NuGet to download missing packages -->
    <add key="enabled" value="True" />

    <!-- Automatically check for missing packages during build in Visual Studio -->
    <add key="automatic" value="True" />
  </packageRestore>
  <!--
  Used to specify the default Sources for list, install and update.
  See: NuGet.exe help list
  See: NuGet.exe help install
  See: NuGet.exe help update
  -->
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
  <!-- used to store credentials -->
  <!-- Used to specify which one of the sources are active -->
  <!-- Used to disable package sources  -->
  <disabledPackageSources>
    <add key="Microsoft and .NET" value="true" />
  </disabledPackageSources>
  <!-- 
  Used to specify default API key associated with sources. 
  See: NuGet.exe help setApiKey
  See: NuGet.exe help push
  See: NuGet.exe help mirror
  -->
  <apikeys>
    <add key="http://MyRepo/ES/api/v2/package" value="encrypted_api_key" />
  </apikeys>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <activePackageSource>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </activePackageSource>
</configuration>

Most helpful comment

@brainwipe Thanks for the solution. Just wanted to add that in my case I didn't have to reinstall the NuGet extension. I just deleted/moved the config file from %appdata% and restarted VS.

All 9 comments

@brainwipe thanks for this report

Can you try a few things

  1. Does this work outside of your proxy (so the question - did something change in your proxy settings)?
  2. Can you share a fiddler trace?

CC @maartenba @xavierdecoster

Thanks for getting back to me.

  1. I have no proxy - I am plugged straight into DSL router both home and office.
  2. No fiddler trace is produced (although I can see other services calling back and forth without a problem)

Are there any other diagnostics I can help with?

That's odd, do you have https setup for fiddler? You are definitely getting an answer from somewhere given the error log.

Also best start Fiddler before starting VS so it uses Fiddler as the proxy. Some tips in our docs https://docs.nuget.org/consume/nuget-faq#managing-packages-in-nuget.org

Also what happens when you paste the URL into a browser?

Thanks for the feedback.

  • Fiddler is configured for HTTPS
  • I ran Fiddler before VS. I know VS is using the proxy because I can see other HTTPS requests that VS is doing.
  • When I put the URL into the browser, I get the JSON back, starting with:
{
  "version": "3.0.0-beta.1",
  "resources": [
    {
      "@id": "https://api-v3search-0.nuget.org/query",
      "@type": "SearchQueryService",
      "comment": "Query endpoint of NuGet Search service (primary)"
    },
    // snip

I'm a bit stumped, I have never seen something like this. Would you be kind enough to attach a debugger, and get the callstack from where this is throwing and perhaps a bit more clues?

I have a solution!

Cause: Corrupted %appdata%/nuget.config

Solution:

Warning: this solution will remove any custom config you might had added, such as additional package sources and proxy config.

  • Uninstall NuGet Visual Studio extension
  • Navigate to: %appdata%/Nuget
  • Move NuGet.Config out of the folder
  • Reinstall NuGet Visual Studio Extension
  • Restart Visual Studio and open package manager console (around this time you will get a new NuGet.config).
  • Reapply custom NuGet configuration.

Notes

Uninstalling Visual Studio NuGet extension does not delete the NuGet.config file. This is completely reasonable (expected) behaviour. Downside is that if this file is corrupted (as mine was) then you must delete manually.

I don't know what caused the corruption. I tried killing the Visual Studio process while performing NuGet config or using non-standard characters in package source names but I can't see the dodgy character in my config file.

A final thank you to the community for your help, it was much appreciated. Leaving this full solution here in case anyone else has a similar problem. Problem closed!

@brainwipe Thanks for the solution. Just wanted to add that in my case I didn't have to reinstall the NuGet extension. I just deleted/moved the config file from %appdata% and restarted VS.

Was this page helpful?
0 / 5 - 0 ratings