Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type initializer for 'Nuget.Proxy Cache' threw an exception

I am getting the error The type initializer for 'Nuget.Proxy Cache' threw an exception when trying to connect to the Nuget offcial Package source. I am behind a corporate network, however I doubt the issue is connectivity.

Any ideas?

like image 278
user979441 Avatar asked Jun 13 '13 22:06

user979441


1 Answers

I have the same issue. I used the following powershell command in the Package Manager Console to help me find the source:

try {
    update-package nunit}
catch{
    $error| Format-List * -Force    
    $Exception = $error[0].Exception
    for ($i = 0; $Exception; $i++, ($Exception = $Exception.InnerException))
    {   "$i" * 80
        $Exception |Format-List * -Force
    }
}

In my case the underlying error was:

System.DllNotFoundException: Unable to load DLL 'rasapi32.dll': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Attaching a debugger and then looking at the NuGet source code it's being thrown when NuGet tries to see if the solution is in source control. The error gets thrown by the EnvDTE interface, which is exposed by visual studio.

I'll update this if I actually solve the problem, but hopefully this is a start.

like image 151
aboy021 Avatar answered Nov 15 '22 08:11

aboy021