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

The type initializer for 'NuGet.ConfigurationDefaults' threw an exception. #834

Closed
tvperez opened this issue Jun 23, 2015 · 13 comments
Closed
Labels
Resolution:Duplicate This issue appears to be a Duplicate of another issue

Comments

@tvperez
Copy link

tvperez commented Jun 23, 2015

Hi All,

I just installed the latest version of the Nuget Console Manager and it appears that no matter what command I use on the Nuget.exe command line app, I get the following exception: The type initializer for 'NuGet.ConfigurationDefaults' threw an exception.

Any ideas on how I can resolve this issue? Thanks.

Sincerely,
Tony

@yishaigalatzer
Copy link

Hey Tony, can you please provide us with more details?

Are you using visual studio extension or nuget.exe (Console Manager is in visual studio, and nuget.exe is on the command line).

What version are you using? Where did you get it from? What do you mean by installing it.

Are you able to provide a call stack, and a reproducible scenario?

@tvperez
Copy link
Author

tvperez commented Jun 24, 2015

Hi Yishai,

I am using both the Visual Studio Extension and the Nuget.exe. Neither one is working at the moment.

The version is the Nuget.exe is 2.8.5. I downloaded both the VS Extension and Nuget.exe from http://docs.nuget.org/consume/installing-nuget.

As for the call stack, this is what I get from Nuget.exe:

The type initializer for 'NuGet.ConfigurationDefaults' threw an exception.
at NuGet.ConfigurationDefaults.InitializeInstance()
at NuGet.ConfigurationDefaults..cctor()
--- End of inner exception stack trace ---
at NuGet.ConfigurationDefaults.get_Instance()
at NuGet.PackageSourceBuilder.CreateSourceProvider(ISettings settings)
at NuGet.Commands.Command.Execute()
at NuGet.Program.Main(String[] args)

Thank you for your time and expertise.

Sincerely,
Tony V Perez
From: Yishai Galatzer [mailto:notifications@github.com]
Sent: Tuesday, June 23, 2015 4:01 PM
To: NuGet/Home Home@noreply.github.com
Cc: Tony Perez Tony.Perez@microsoft.com
Subject: Re: [Home] The type initializer for 'NuGet.ConfigurationDefaults' threw an exception. (#834)

Hey Tony, can you please provide us with more details?

Are you using visual studio extension or nuget.exe (Console Manager is in visual studio, and nuget.exe is on the command line).

What version are you using? Where did you get it from? What do you mean by installing it.

Are you able to provide a call stack, and a reproducible scenario?


Reply to this email directly or view it on GitHubhttps://github.com//issues/834#issuecomment-114667517.

@yishaigalatzer
Copy link

What version of visual studio are you usng?

And can you attach a debugger and get more info on the exception? I can't tell what is the inner exception

@tvperez
Copy link
Author

tvperez commented Jun 24, 2015

I am using Visual Studio 2013 Update 4.

As for attaching a debugger, the error occurs the moment I execute the Nuget.exe app.
From: Yishai Galatzer [mailto:notifications@github.com]
Sent: Wednesday, June 24, 2015 12:03 PM
To: NuGet/Home Home@noreply.github.com
Cc: Tony Perez Tony.Perez@microsoft.com
Subject: Re: [Home] The type initializer for 'NuGet.ConfigurationDefaults' threw an exception. (#834)

What version of visual studio are you usng?

And can you attach a debugger and get more info on the exception? I can't tell what is the inner exception


Reply to this email directly or view it on GitHubhttps://github.com//issues/834#issuecomment-114981434.

@yishaigalatzer
Copy link

Here is how to do it, run nuget.exe from visual studio,

Use File->Open project and select Exe Project File from the bottom right drop down

image

Then set all the parameters you need on the properties page

image

@tvperez
Copy link
Author

tvperez commented Jun 29, 2015

Hi Yishai,

When I loaded the Nuget.exe as a project, I received the following message:
[cid:image001.jpg@01D0B250.15584AA0]

As for debugging, the executable terminates even if I tried to use the Debug “Step into new process”. As for the activity log, this is what was logged:


1348
2015/06/29 16:36:39.446
Information
VisualStudio
Begin package load [IntegrationPackage]
{D209E4D9-0F58-4BC3-A529-FDCF20967DC0}


1349
2015/06/29 16:36:40.399
Information
VisualStudio
Entering function VBDispatch::GetTypeLib


1350
2015/06/29 16:36:40.399
Information
VisualStudio
Leaving function VBDispatch::GetTypeLib
{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}


1351
2015/06/29 16:36:40.461
Error
VisualStudio
SetSite failed for package [IntegrationPackage]
{D209E4D9-0F58-4BC3-A529-FDCF20967DC0}


80131509
GetExportedValue cannot be called before prerequisite import 'NuGet.VisualStudio.VsPackageSourceProvider..ctor (Parameter="settings", ContractName="NuGet.ISettings")' has been set.


1352
2015/06/29 16:36:40.477
Error
VisualStudio
End package load [IntegrationPackage]
{D209E4D9-0F58-4BC3-A529-FDCF20967DC0}

80131509
Object reference not set to an instance of an object.

Sincerely,
Tony V Perez
From: Yishai Galatzer [mailto:notifications@github.com]
Sent: Monday, June 29, 2015 9:05 AM
To: NuGet/Home Home@noreply.github.com
Cc: Tony Perez Tony.Perez@microsoft.com
Subject: Re: [Home] The type initializer for 'NuGet.ConfigurationDefaults' threw an exception. (#834)

Here is how to do it, run nuget.exe from visual studio,

Use File->Open project and select Exe Project File from the bottom right drop down

[image]https://cloud.githubusercontent.com/assets/1238711/8412259/8b8875fc-1e3d-11e5-8eef-76c4da9c2149.png

Then set all the parameters you need on the properties page

[image]https://cloud.githubusercontent.com/assets/1238711/8412318/ece66f7a-1e3d-11e5-86bc-8c51eb0ce498.png


Reply to this email directly or view it on GitHubhttps://github.com//issues/834#issuecomment-116743478.

@yishaigalatzer
Copy link

The log doesn't seem related to nuget.exe, and the image didn't come through.

Can you try again to share the image? Perhaps use github.com directly instead of by email?

@tvperez
Copy link
Author

tvperez commented Jul 1, 2015

I’ve attached the image.

The log was generated when attempting to use the Nuget package from VS2013. So far, it appears that this issue is due to the Nuget application inability to load a configuration file. My questions are:

  1.   Which configuration file or registry entry is consumed when the Nuget application initializes?
    
  2.   Is it possible to force the Nuget.exe to start in verbose mode?
    

From: Yishai Galatzer [mailto:notifications@github.com]
Sent: Wednesday, July 1, 2015 9:40 AM
To: NuGet/Home Home@noreply.github.com
Cc: Tony Perez Tony.Perez@microsoft.com
Subject: Re: [Home] The type initializer for 'NuGet.ConfigurationDefaults' threw an exception. (#834)

The log doesn't seem related to nuget.exe, and the image didn't come through.

Can you try again to share the image? Perhaps use github.com directly instead of by email?


Reply to this email directly or view it on GitHubhttps://github.com//issues/834#issuecomment-117743471.

@tvperez
Copy link
Author

tvperez commented Jul 1, 2015

Hi Yishai,

Here’s a stack trace generated from Nuget.exe:

 at NuGet.ConfigurationDefaults.InitializeInstance()
 at NuGet.ConfigurationDefaults..cctor()
 --- End of inner exception stack trace ---
 at NuGet.ConfigurationDefaults.get_Instance()
 at NuGet.PackageSourceBuilder.CreateSourceProvider(ISettings settings)
 at NuGet.Commands.Command.Execute()
 at NuGet.Program.Main(String[] args)

Does this help?

Sincerely,
Tony V Perez
From: Tony Perez
Sent: Wednesday, July 1, 2015 10:15 AM
To: NuGet/Home reply@reply.github.com; NuGet/Home Home@noreply.github.com
Subject: RE: [Home] The type initializer for 'NuGet.ConfigurationDefaults' threw an exception. (#834)

I’ve attached the image.

The log was generated when attempting to use the Nuget package from VS2013. So far, it appears that this issue is due to the Nuget application inability to load a configuration file. My questions are:

  1.  Which configuration file or registry entry is consumed when the Nuget application initializes?
    
  2.  Is it possible to force the Nuget.exe to start in verbose mode?
    

From: Yishai Galatzer [mailto:notifications@github.com]
Sent: Wednesday, July 1, 2015 9:40 AM
To: NuGet/Home Home@noreply.github.com
Cc: Tony Perez Tony.Perez@microsoft.com
Subject: Re: [Home] The type initializer for 'NuGet.ConfigurationDefaults' threw an exception. (#834)

The log doesn't seem related to nuget.exe, and the image didn't come through.

Can you try again to share the image? Perhaps use github.com directly instead of by email?


Reply to this email directly or view it on GitHubhttps://github.com//issues/834#issuecomment-117743471.

@tvperez
Copy link
Author

tvperez commented Jul 1, 2015

Hi Yishai,

Here’s a stack trace generated from Nuget.exe:

 C:\UStoreLoadTesting_Main_Perm>nuget restore "C:\UStoreLoadTesting_Main_Perm\nup

kgs\packages.config" -Verbosity Detailed
System.TypeInitializationException: The type initializer for 'NuGet.Configuratio
nDefaults' threw an exception. ---> System.Xml.XmlException: '.', hexadecimal va
lue 0x00, is an invalid character. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Char[] data, Int32 length, I
nt32 invCharPos)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at NuGet.XmlUtility.LoadSafe(Stream input, LoadOptions options)
at NuGet.XmlUtility.GetDocument(IFileSystem fileSystem, String path)
at NuGet.XmlUtility.GetOrCreateDocument(XName rootName, IFileSystem fileSyste
m, String path)
at NuGet.Settings.<>c__DisplayClass1.<.ctor>b__0()
at NuGet.Settings.ExecuteSynchronized(Action ioOperation)
at NuGet.Settings..ctor(IFileSystem fileSystem, String fileName, Boolean isMa
chineWideSettings)
at NuGet.ConfigurationDefaults..ctor(IFileSystem fileSystem, String path)
at NuGet.ConfigurationDefaults.InitializeInstance()
at NuGet.ConfigurationDefaults..cctor()
--- End of inner exception stack trace ---
at NuGet.ConfigurationDefaults.get_Instance()
at NuGet.PackageSourceBuilder.CreateSourceProvider(ISettings settings)
at NuGet.Commands.Command.Execute()
at NuGet.Program.Main(String[] args)
Does this help?

Sincerely,
Tony V Perez
From: Tony Perez
Sent: Wednesday, July 1, 2015 10:15 AM
To: NuGet/Home reply@reply.github.com; NuGet/Home <Home@noreply.github.commailto:Home@noreply.github.com>
Subject: RE: [Home] The type initializer for 'NuGet.ConfigurationDefaults' threw an exception. (#834)

I’ve attached the image.

The log was generated when attempting to use the Nuget package from VS2013. So far, it appears that this issue is due to the Nuget application inability to load a configuration file. My questions are:

  1.  Which configuration file or registry entry is consumed when the Nuget application initializes?
    
  2.  Is it possible to force the Nuget.exe to start in verbose mode?
    

From: Yishai Galatzer [mailto:notifications@github.com]
Sent: Wednesday, July 1, 2015 9:40 AM
To: NuGet/Home <Home@noreply.github.commailto:Home@noreply.github.com>
Cc: Tony Perez <Tony.Perez@microsoft.commailto:Tony.Perez@microsoft.com>
Subject: Re: [Home] The type initializer for 'NuGet.ConfigurationDefaults' threw an exception. (#834)

The log doesn't seem related to nuget.exe, and the image didn't come through.

Can you try again to share the image? Perhaps use github.com directly instead of by email?


Reply to this email directly or view it on GitHubhttps://github.com//issues/834#issuecomment-117743471.

@yishaigalatzer
Copy link

Look for nuget.config files in your folder and up the tree, and also in XXX\AppData\Roaming\NuGet

@yishaigalatzer
Copy link

ping, any updates?

@deepakaravindr deepakaravindr added this to the 3.2.0-commandline milestone Aug 6, 2015
@yishaigalatzer
Copy link

This looks like a duplicate of an issue we have for throwing proper exception when configuration is corrupt. The error should throw the file name that is introducing the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution:Duplicate This issue appears to be a Duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants