Error When Opening Console (I don't have Reflector add-in)

Mar 16, 2011 at 5:49 PM


I installed NuGet via the MVC 3 install and upgraded to the latest version. However, when I open the Package Manager Console, I receive some errors and cannot use it. I've been trying to find a solution to this problem but haven't found anyone with a similar scenario.

NOTE: I do not have the Reflector VS add-in installed.

When I open the Package Manager Console, the following error shows up in it:

System.Management.Automation.CmdletInvocationException: Not found  ---> System.Management.ManagementException: Not found 
   at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
   at System.Management.ManagementScope.InitializeGuts(Object o)
   at System.Management.ManagementScope.Initialize()
   at System.Management.ManagementObject.Initialize(Boolean getObject)
   at System.Management.ManagementObject.Get()
   at System.Management.Automation.PsUtils.GetParentProcess(Process current)
   at System.Management.Automation.SecuritySupport.GetExecutionPolicy(String shellId, ExecutionPolicyScope scope)
   at System.Management.Automation.SecuritySupport.GetExecutionPolicy(String shellId)
   at Microsoft.PowerShell.Commands.GetExecutionPolicyCommand.BeginProcessing()
   at System.Management.Automation.Cmdlet.DoBeginProcessing()
   at System.Management.Automation.CommandProcessorBase.DoBegin()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.Runspaces.Pipeline.Invoke()
   at NuGetConsole.Host.PowerShell.Implementation.PowerShellHost.Invoke(String command, Object input, Boolean outputResults)
   at NuGetConsole.Host.PowerShell.Implementation.PowerShellHostExtensions.GetExecutionPolicy(PowerShellHost host, String command)
   at NuGetConsole.Host.PowerShell.Implementation.PowerShellHost.LoadStartupScripts()
   at NuGetConsole.Host.PowerShell.Implementation.PowerShellHost.Initialize()
   at NuGetConsole.Implementation.Console.ConsoleDispatcher.Start()
   at NuGetConsole.Implementation.PowerConsoleToolWindow.MoveFocus(FrameworkElement consolePane)

When I start typing in it, I get a popup error; VS says to look in the Activity Log, which says:


System.InvalidOperationException: Nullable object must have a value. 
  at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) 
  at System.Nullable`1.get_Value() 
  at NuGetConsole.Implementation.Console.WpfConsole.GetInputLineExtent(Int32 start, Int32 length) 
  at NuGetConsole.Implementation.Console.WpfConsoleKeyProcessor.InternalExec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) 
  at NuGetConsole.Implementation.Console.OleCommandFilter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) 
  at Microsoft.VisualStudio.Editor.Implementation.VsTextViewAdapter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) 
  at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.SendCommand(Guid cmdGroup, UInt32 cmdID, Object inParam) 
  at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.TextInput(TextCompositionEventArgs args) 
  at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.b__0(KeyProcessor p, TextCompositionEventArgs args) 
  at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<>c__DisplayClass1e`1.b__1a() 
  at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)


Any ideas? 





Mar 16, 2011 at 6:36 PM

What is the version of NuGet that you are running? And what is your OS?

Also, can you look into this folder: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\<version\, and list all the files in there? I'm trying to figure out if any file is missing from your installation of nuget.


Mar 16, 2011 at 6:39 PM

Oh, I forgot. The stack trace suggests it has something to do with the group policy on your machine. Do you set the group policy on PowerShell script execution, or perhaps you are in a corporate environment which enforces it?

Mar 16, 2011 at 6:43 PM

Running Windows 7, 64-bit. NuGet version

File list:
package  [DIR]
Resources  [DIR]
Scripts  [DIR]
_rels  [DIR]

Mar 16, 2011 at 6:52 PM

Good thought on the group policy. We do have corporate group policies. I know there was one that restricted running unsigned scripts. About a year ago I had them lift that restriction for me, but have since upgraded my machine to Win 7. I'm not sure if that would affect the policy setting (either a different setting, or need to be reapplied).

I'll have to look into the what group policies are applied.

Mar 16, 2011 at 6:59 PM

We do have code to detect if your group policy prohibits unsigned scripts and give a warning instead of crashing in your case. Perhaps our detection code is not robust enough. I'm interested in knowing what you'll find out about the situation on your machine.

In NuGet 1.3, we'll sign our PS scripts so that you won't have this issue again.