3

Closed

Input string was not in a correct format

description

I have upgrade to the latest NuGet version 2.7, and I now get the following error when trying to install a package. I am running on VS2012 Ultimate. I had all of the latest updateds installed. I did just install an update to VS for I believe the Windows Phone 8 that was in the extensions list. I also just installed the latest version of Typescript.

PM> install-package log4net
Installing 'log4net 2.0.0'.
Successfully installed 'log4net 2.0.0'.
Adding 'log4net 2.0.0' to Tyson.OperatorUpload.
Install failed. Rolling back...
install-package : Input string was not in a correct format.
At line:1 char:1
  • install-package log4net
  • ~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [Install-Package], FormatException
    • FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM>

file attachments

Closed Sep 12, 2013 at 1:43 PM by dotnetjunky
To resolve this error, run this command from an elevated prompt:

regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"

comments

dotnetjunky wrote Aug 23, 2013 at 8:02 PM

Hi, what project did you try to install it to? Also, after getting this error, can you type this command:
$error[0].Exception.StackTrace
and paste the value here? Thanks

joswalt wrote Aug 26, 2013 at 1:46 PM

PM> $error[0].Exception.StackTrace
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at NuGet.PowerShell.Commands.NuGetBaseCommand.Log(MessageLevel level, String message, Object[] args)
at NuGet.VisualStudio.VsProjectSystem.RemoveReference(String name)
at NuGet.ProjectManager.RemovePackageReferenceFromProject(IPackage package)
at NuGet.ProjectManager.Execute(PackageOperation operation)
at NuGet.ProjectManager.Execute(IPackage package, IPackageOperationResolver resolver)
at NuGet.ProjectManager.RemovePackageReference(IPackage package, Boolean forceRemove, Boolean removeDependencies)
at NuGet.VisualStudio.VsPackageManager.RollbackProjectActions(IProjectManager projectManager, IEnumerable1 packagesAdded, IEnumerable1 packagesRemoved)
at NuGet.VisualStudio.VsPackageManager.RunProjectAction(IProjectManager projectManager, Action action)
at NuGet.VisualStudio.VsPackageManager.AddPackageReference(IProjectManager projectManager, IPackage package, Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
at NuGet.VisualStudio.VsPackageManager.<>c__DisplayClass7.<InstallPackage>b__4()
at NuGet.VisualStudio.VsPackageManager.RunSolutionAction(Action action)
at NuGet.VisualStudio.VsPackageManager.InstallPackage(IProjectManager projectManager, String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersi
ons, Boolean skipAssemblyReferences, ILogger logger)
at NuGet.VisualStudio.VsPackageManager.InstallPackage(IProjectManager projectManager, String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersi
ons, ILogger logger)
at NuGet.PowerShell.Commands.InstallPackageCommand.ProcessRecordCore()
at NuGet.PowerShell.Commands.NuGetBaseCommand.ProcessRecord()

joswalt wrote Aug 26, 2013 at 1:50 PM

I only get the error when adding packages that add a reference. I don't get the error for packages like jquery.

endlessracingz wrote Aug 30, 2013 at 2:27 AM

I am also having the same issue on any of the packages I am trying to install. They all happened to have been packages that add a reference.

I have the latest NuGet version 2.7.40808.167, but I am running VS2010 Pro.

PM> Install-Package nbehave
Installing 'nbehave 0.6.2'.
Successfully installed 'nbehave 0.6.2'.
Adding 'nbehave 0.6.2' to OSIM.UnitTests.
Install failed. Rolling back...
Install-Package : Input string was not in a correct format.
At line:1 char:16
  • Install-Package <<<< nbehave
    • CategoryInfo : NotSpecified: (:) [Install-Package], FormatException
    • FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM> $error[0].Exception.StackTrace
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at NuGet.PowerShell.Commands.NuGetBaseCommand.Log(MessageLevel level, String message, Object[] args)
at NuGet.VisualStudio.VsProjectSystem.RemoveReference(String name)
at NuGet.ProjectManager.RemovePackageReferenceFromProject(IPackage package)
at NuGet.ProjectManager.Execute(PackageOperation operation)
at NuGet.ProjectManager.Execute(IPackage package, IPackageOperationResolver resolver)
at NuGet.ProjectManager.RemovePackageReference(IPackage package, Boolean forceRemove, Boolean removeDependencies)
at NuGet.VisualStudio.VsPackageManager.RollbackProjectActions(IProjectManager projectManager, IEnumerable1 packagesAdded, IEnumerable1 packagesRemoved)
at NuGet.VisualStudio.VsPackageManager.RunProjectAction(IProjectManager projectManager, Action action)
at NuGet.VisualStudio.VsPackageManager.AddPackageReference(IProjectManager projectManager, IPackage package, Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
at NuGet.VisualStudio.VsPackageManager.<>c__DisplayClass7.<InstallPackage>b__4()
at NuGet.VisualStudio.VsPackageManager.RunSolutionAction(Action action)
at NuGet.VisualStudio.VsPackageManager.InstallPackage(IProjectManager projectManager, String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions, Boolean skipAssemblyRefer
ences, ILogger logger)
at NuGet.VisualStudio.VsPackageManager.InstallPackage(IProjectManager projectManager, String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions, ILogger logger)
at NuGet.PowerShell.Commands.InstallPackageCommand.ProcessRecordCore()
at NuGet.PowerShell.Commands.NuGetBaseCommand.ProcessRecord()

endlessracingz wrote Aug 30, 2013 at 6:40 PM

I really want to work on a few projects but I can't because the 3rd party packages I want to use are not accessible due to this issue coupled with the fact that I there are no download links for the packages.

deepakverma wrote Aug 30, 2013 at 7:13 PM

I tried the scenario on NuGet 2.7 + VS 2012 and was not able to repro
Install-Package nbehave
'nbehave 0.6.2' already installed.
Adding 'nbehave 0.6.2' to UnitTestProject1.
Successfully added 'nbehave 0.6.2' to UnitTestProject1.

install-package log4net
Installing 'log4net 2.0.0'.
Successfully installed 'log4net 2.0.0'.
Adding 'log4net 2.0.0' to MvcApplication1.
Successfully added 'log4net 2.0.0' to MvcApplication1.
  1. Can you please try to install it on a vanilla project and see if it works for you. This might help to narrow down the repro to see if there is anything specific in your solution that's causing it to fail. Can you share a narrowed down project that fails.
  2. Are you able to install the same package on the project where it repros from package manage dialog?
Thanks

endlessracingz wrote Sep 3, 2013 at 6:04 PM

@deepakverma

For #1: As per your instructions I created a vanilla project (Windows Forms Application) and tried to install nbehave and I am still received the same failed installation:
PM> install-package nbehave
Installing 'nbehave 0.6.2'.
Successfully installed 'nbehave 0.6.2'.
Adding 'nbehave 0.6.2' to WindowsFormsApplication1.
Install failed. Rolling back...
Install-Package : Input string was not in a correct format.
At line:1 char:16
+ install-package <<<<  nbehave
    + CategoryInfo          : NotSpecified: (:) [Install-Package], FormatException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
 
PM> $error[0].Exception.StackTrace
   at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
   at System.String.Format(IFormatProvider provider, String format, Object[] args)
   at NuGet.PowerShell.Commands.NuGetBaseCommand.Log(MessageLevel level, String message, Object[] args)
   at NuGet.VisualStudio.VsProjectSystem.RemoveReference(String name)
   at NuGet.ProjectManager.RemovePackageReferenceFromProject(IPackage package)
   at NuGet.ProjectManager.Execute(PackageOperation operation)
   at NuGet.ProjectManager.Execute(IPackage package, IPackageOperationResolver resolver)
   at NuGet.ProjectManager.RemovePackageReference(IPackage package, Boolean forceRemove, Boolean removeDependencies)
   at NuGet.VisualStudio.VsPackageManager.RollbackProjectActions(IProjectManager projectManager, IEnumerable`1 packagesAdded, IEnumerable`1 packagesRemoved)
   at NuGet.VisualStudio.VsPackageManager.RunProjectAction(IProjectManager projectManager, Action action)
   at NuGet.VisualStudio.VsPackageManager.AddPackageReference(IProjectManager projectManager, IPackage package, Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
   at NuGet.VisualStudio.VsPackageManager.<>c__DisplayClass7.<InstallPackage>b__4()
   at NuGet.VisualStudio.VsPackageManager.RunSolutionAction(Action action)
   at NuGet.VisualStudio.VsPackageManager.InstallPackage(IProjectManager projectManager, String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions, Boolean skipAssemblyRefer
ences, ILogger logger)
   at NuGet.VisualStudio.VsPackageManager.InstallPackage(IProjectManager projectManager, String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions, ILogger logger)
   at NuGet.PowerShell.Commands.InstallPackageCommand.ProcessRecordCore()
   at NuGet.PowerShell.Commands.NuGetBaseCommand.ProcessRecord()
For #2: I receive the same error as I do within the Package Manager Console (see attached file for screen shot of error).

endlessracingz wrote Sep 3, 2013 at 6:09 PM

The file attachment referenced in #2 of my previous post does not appear to have been attached properly. So let's try it again.

deepakverma wrote Sep 4, 2013 at 10:57 PM

hmm, from the call stack it looks like it tried to install the package and failed, then started rolling back. i am running out of ideas to get to the root cause.
Can you try to attach a debugger and see what's going on here to help to get to the root cause? (instructions can be found here http://docs.nuget.org/docs/contribute/setting-up-the-nuget-development-environment)

can you also try clearing up your package cache to get a fresh copy of the package to see it helps (tools->options->package manager-> clear cache)

btw, I assume you have the latest NuGet 2.7 http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c?SRC=Home

endlessracingz wrote Sep 5, 2013 at 4:00 PM

@deepakverma

I will try to attach the debugger for you and re-post those results.

I tried clearing up my package cache but received the same results as previously listed when trying to install the package on a vanilla project.

And yes, as you can see below I do have the latest NuGet 2.7
Package Manager Console Host Version 2.7.40808.167

Type 'get-help NuGet' to see all available NuGet commands.

PM> install-package nbehave
Installing 'nbehave 0.6.2'.
Successfully installed 'nbehave 0.6.2'.
Adding 'nbehave 0.6.2' to WindowsFormsApplication1.
Install failed. Rolling back...
Install-Package : Input string was not in a correct format.
At line:1 char:16
+ install-package <<<<  nbehave
    + CategoryInfo          : NotSpecified: (:) [Install-Package], FormatException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
 
PM> 

deepakverma wrote Sep 5, 2013 at 5:16 PM

thanks @endlessracingz

endlessracingz wrote Sep 5, 2013 at 5:17 PM

@deepakverma

I am not sure if I followed the debugging process correctly but I was able to run VsExtension project.

I recieved the following when trying to install nbehave on a vanilla project:
PM> install-package nbehave
Installing 'nbehave 0.6.2'.
Successfully installed 'nbehave 0.6.2'.
Adding 'nbehave 0.6.2' to WindowsFormsApplication1.
Install failed. Rolling back...
Which brought me to line 403 of NuGetBaseCommands.cs where I ran in to an unhandled Pipeline Stopped Exception. This is the exception detail:
System.Management.Automation.PipelineStoppedException was unhandled by user code
  Message=The pipeline has been stopped.
  Source=System.Management.Automation
  WasThrownFromThrowStatement=false
  StackTrace:
       at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
       at System.Management.Automation.Cmdlet.ThrowTerminatingError(ErrorRecord errorRecord)
       at NuGet.PowerShell.Commands.NuGetBaseCommand.NuGet.PowerShell.Commands.IErrorHandler.HandleError(ErrorRecord errorRecord, Boolean terminating) in C:\Projects\nuget\src\VsConsole\PowerShellCmdlets\NuGetBaseCommand.cs:line 403
       at NuGet.PowerShell.Commands.NuGetBaseCommand.NuGet.PowerShell.Commands.IErrorHandler.HandleException(Exception exception, Boolean terminating, String errorId, ErrorCategory category, Object target) in C:\Projects\nuget\src\VsConsole\PowerShellCmdlets\NuGetBaseCommand.cs:line 419
       at NuGet.PowerShell.Commands.NuGetBaseCommand.ProcessRecord() in C:\Projects\nuget\src\VsConsole\PowerShellCmdlets\NuGetBaseCommand.cs:line 127
       at System.Management.Automation.Cmdlet.DoProcessRecord()
       at System.Management.Automation.CommandProcessor.ProcessRecord()
  InnerException: 
Please let me know what other information I can provide to help solve this issue!

choler wrote Sep 5, 2013 at 8:16 PM

Anyone able to resolve this issue? I am unable to upgrade, uninstall or install new nuget packages. This only started after upgrading 2.7.

deepakverma wrote Sep 5, 2013 at 11:54 PM

@choler can you share your project and the package you are trying to update?

joswalt wrote Sep 6, 2013 at 1:40 AM

I was able to get around the issue by uninstalling the 2.7 version of NuGet and installing the 2.6 version. I haven't wanted to try to install the 2.7 version again.

dotnetjunky wrote Sep 6, 2013 at 2:37 AM

@endlessracingz: If you put a break point at line 148 of the file NuGetBaseCommand.cs, eventually you will be able to see the value of the 'message' and 'args' parameters which cause the call to String.Format() to fail.

Also, remember to go to the Debug - Exceptions dialog and check the Format exception.

Btw, what is the locale of your OS or VS?

dotnetjunky wrote Sep 6, 2013 at 3:03 AM

I meant the System.FormatException exception.

endlessracingz wrote Sep 6, 2013 at 4:48 AM

@dotnetjunky

the locale is en-US

I'm a relatively new programmer so this may be overkill but I would rather give more than not enough.

Ran in to the following message during the string format.
Unable to cast COM object of type 'System.__ComObject' to interface type 'VSLangProj.References'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B8758EE4-0553-4BC9-8432-440449D35C14}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

choler wrote Sep 6, 2013 at 1:56 PM

@deepakverma -- the issue happens across multiple projects. I tired new project and then tried to add/update nuget packages and also tired an add/update nuget on an existing project. Even uninstall of project seems to be effected.

@joswalt -- that is exactly what I ended up doing. The same packages install correctly with 2.6. Not sure what the issue is but I reverted back to 2.6. Sure visual studio complains that there is an upgrade... but I know better vs.

dotnetjunky wrote Sep 6, 2013 at 6:21 PM

@choler:

Which line of code throws that error message? It's a VS error message, so it's unlikely thrown by the String.Format() call. I want you to put a break point at the String.Format() at line 148. It will be hit multiple times. Every time it gets hit, press F10 to step over it. Keep trying that until you get the exception. When it happens, check the value of the 'message' and 'args' variables and share them here.

If you are not comfortable with that, do you want to chat over Skype so that I can assist you step by step?

Also, do you have any VS extension and/or add-in installed, besides NuGet? Could you try disabling all of them and see if it help.

choler wrote Sep 9, 2013 at 1:17 PM

@dotnetjunky:

I will try those things out asap and post the results. I maybe a little delayed because I need to get something else completed soon.

dotnetjunky wrote Sep 10, 2013 at 12:06 AM

In case you missed my earlier comment:

Also, do you have any VS extension and/or add-in installed, besides NuGet? Could you try disabling all of them and see if it help.

dotnetjunky wrote Sep 10, 2013 at 12:41 AM

Another thing is: Does it happen to other packages or just nbehave?

kevinhauk wrote Sep 10, 2013 at 9:10 AM

Hi,

I am getting exactly the same problem with any nuget package on new and existing projects. With regards to the error message mentioned above
Unable to cast COM object of type 'System.__ComObject' to interface type 'VSLangProj.References'. ... interface with IID '{B8758EE4-0553-4BC9-8432-440449D35C14}' failed due to the following error: Error loading type library/DLL. ...
I know next to zilch about interop so I hope this is not a red herring but looking thru the registry I found that HKCR B8758EE4-0553-4BC9-8432-440449D35C14 references TypeLib HKCR 49A1950E-3E35-4595-8CB9-920C64C44D67 which has PrimaryInteropAssemblyName 'VSLangProj, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. On my machine I have VSLangProj.dll version 7.00.9466.1 in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies and C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies. I am using Vs2012. Is the version mismatch important?

dotnetjunky wrote Sep 10, 2013 at 2:06 PM

Thanks for reporting. Interesting idea about the version mismatch.

You said you are using VS2012, so do you have the VSLangProj.dll in C :\Program Files (x86)\ Microsoft Visual Studio 11.0 \Common7\IDE\PublicAssemblies?

endlessracingz wrote Sep 10, 2013 at 3:32 PM

@dotnetjunky

It happens to every package that attempts to add references to the project.
It will say that it fails and rolls back but if I attempt to re-install it says it is already installed and if I try to uninstall/remove it it fails.

dotnetjunky wrote Sep 10, 2013 at 6:06 PM

@endlesracingz:

What version VS are you running? Do you have multiple versions of Visual Studio installed on your box?

Also, please run this command in the VS Developer Command Prompt and report the result:

gacutil /l VSLangProj

dotnetjunky wrote Sep 10, 2013 at 6:18 PM

Hi guys, is it possible that I can with you through Skype or http://jabber.net? I will help me diagnose the problem quickly.

dotnetjunky wrote Sep 10, 2013 at 11:09 PM

Hi guys,

I've made a possible fix for the error. Please help us install the attached VSIX and verify if it fixes the error. Thanks.

dotnetjunky wrote Sep 11, 2013 at 6:17 AM

Before you try the VSIX though, please try running this command from an elevated prompt to see if it helps fix the problem with the current NuGet:

regsvr32 VsLangproj.olb

kevinhauk wrote Sep 11, 2013 at 7:40 AM

Doing 'regsvr32 VsLangproj.olb' complained that it couldn't find the file so I had to do regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb" but that didn't help with nuget 2.7. Installed your possible fix but that didn't work either unfortunately.

kevinhauk wrote Sep 11, 2013 at 7:58 AM

Doh! I didn't do the regsvr32 from an evelated prompt! I thought I had because it didn't complain.

Doing regsvr32 from an elevated prompt makes nuget 2.7 work.

JeffHandley wrote Sep 11, 2013 at 8:24 AM

@kevinhauk - awesome, thanks!

@choler and @joswalt - could you please try this too?

joswalt wrote Sep 11, 2013 at 1:54 PM

I ran the 'regsvr32 VsLangproj.olb' command at an elevated command prompt and this fixed the issue for me for NuGet 2.7.

Thanks!

endlessracingz wrote Sep 11, 2013 at 2:44 PM

@dotnetjunky and @jeffHandley

Running:
regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"
Resolved my issue with NuGet 2.7

Thanks so much for your help and work everyone!

dotnetjunky wrote Sep 11, 2013 at 5:05 PM

Thanks for trying and confirming the results. I'm glad the issue has been resolved for everyone.

One more question for you all:

Did you uninstall an older version of Visual Studio recently? For example, did you have VS 2010 and VS 2012 side-by-side and then you uninstall VS 2010? I ask because doing so could potentially unregister the type libraries for COM components.

joswalt wrote Sep 11, 2013 at 7:13 PM

I haven't tried uninstalling an older version of Visual Studio. I only have VS2012 installed.

JeffHandley wrote Sep 11, 2013 at 7:50 PM

@joswalt - did you ever have a prerelease version of VS2012 on your machine by chance, having upgraded to RTM?

joswalt wrote Sep 11, 2013 at 10:17 PM

@JeffHandley - I don't believe that I had a pre-release version of VS2012, but I can't say for sure.

joswalt wrote Sep 11, 2013 at 10:18 PM

@JeffHandley - Luckily, the regsvr32 command fixed the issue for me.

endlessracingz wrote Sep 11, 2013 at 11:15 PM

@dotnetJunky

It is possible that I previously has a VS 2010 express edition installed before I obtained my copy of VS 2010 Professional.

I also have SQL Server Management Studio for SQL Server 2008 installed but I wouldn't think that that would have caused this issue. However, the installation process for SQL Server Management Studio 2008 with Visual Studio 2010 Pro was rather tricky if I remember correctly.

chekm8 wrote Oct 18, 2013 at 7:25 PM

For diagnostic reasons....
I had the same issue today after upgrading to 2.7 . Regsvr worked for me. I do have multiple versions of VS installed and running on my PC. I have not uninstalled anything recently.