Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
VS2015 Nuget Console not loading #1638
Comments
|
Try updating to the latest 3.2.1-rc VSIX here: https://dist.nuget.org/index.html Does this happen with any solution? Does creating a new project also show this error? |
yishaigalatzer
added
the
Viewed
label
Oct 27, 2015
pete1208
commented
Oct 27, 2015
|
I've updated to Package Manager Console Host Version 3.2.1.10581 and the results are the same. Now here's a something to consider, if I create a powershell project and open that, VS2015 will crash. I can see the project files for a moment, then it crashes. I've tried re-installing powershell and have net 3.5 & 4.6 installed in windows features. I also disabled my anti-virus with no affect. |
yishaigalatzer
commented
Oct 27, 2015
|
Can you share a solution that crashes for you? |
yishaigalatzer
commented
Oct 27, 2015
|
Also - Do you have powershell tools installed (https://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597)? What happens if you remove them? Any other extension installed on your visual studio? |
pete1208
commented
Oct 28, 2015
|
I've had the powershell tools installed, then removed them and tried, then re-installed and tried with the same result. As far as a project goes, it is as simple as creating a default C# WPF or C# Forms project. Then going using the tools / nuget / console command with the project open. No special references for anything, just the default starter project. I've repaired VS2015, reinstalled powershell, etc... I wonder if it's a Win10 32 bit issue. Or VMWare issue. The Win10 x86 instance is hosted as guest on VMWare Workstation 12 Pro. Funny thing is, the console works when no project is open. So I'm guessing the error related to reading what the project info..? I've played around with changing the execution policy, with no effect. The only extensions installed from the default are SQL Prompt and Visual Studio Spell Checker. Any ideas would be appreciated. |
pete1208
commented
Oct 28, 2015
|
Ok, i've tried modifying devenv.exe.config. I can now get the console up when a project is open, but there are some errors. However the console prompt does appear. Changes to config file:
Now when the prompt appears and a project is open, i get a few errors: The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\WINDOWS\System32\WindowsPowerShell\v1.0\types.ps1xml(386) : Error in type "System.IO.DirectoryInfo": Exception: Cannot convert the "Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods" value of type "System.String" to type "System.Type". Package Manager Console Host Version 3.2.1.10581 Type 'get-help NuGet' to see all available NuGet commands. PM> ********* so I'm making progress |
pete1208
commented
Oct 29, 2015
|
I've just tried it, and the above workaround allows the entity framework to install, so I'm happy. |
pete1208
closed this
Oct 29, 2015
mhutch
commented
Nov 25, 2015
|
FWIW, I ran into this on Win10 x64. Googling the error message indicated that when it came up in another context, it could fixed by repairing .NET 3.5, so I went to Windows Optional Features and removed .NET 3.5 entirely. That fixed it in this case too. No idea why though! |
pete1208
commented
Nov 25, 2015
|
I tried that uninstalling 3.5, with no luck. I am using using a VM Workstation guest OS Win10 x86. By adding the config lines above it works, if I remove them it fails. There are no error messages when opening the console now too |
yishaigalatzer
commented
Nov 25, 2015
|
@pete1208 any chance we can get access to a machine with this failure? |
mrlund
commented
Nov 28, 2015
|
If it helps, I just had the same issue, running 2015 Update 1 RC on Win10 x64, with an MVC project opened in a new instance after another instance open with a Cordova project. I closed both of them down, and reopened just the MVC project, and the console was working again. |
yishaigalatzer
commented
Nov 29, 2015
|
The problem is that we cannot get a local repro. Is it possible to get access to a machine this happens on? |
fuxuepeng
commented
Dec 1, 2015
|
I was just able to fix this by removing the Nuget extension (via extensions and updates), rebooting, reinstalling it, then rebooting. |
yishaigalatzer
commented
Dec 1, 2015
|
@fuxuepeng we have seen some issues with the MEF catalog in Visual Studio not refreshing properly, and a reinstall or a call to devenv /setup resolves it. now that Update I is out, I recommend to whoever is experiencing this to try again with a fresh install. |
JeremyBP
commented
Dec 2, 2015
|
@yishaigalatzer Still the same error: "The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception" when opening the console after a project loaded. No exception on an empty VS session, the console opened just fine, but if I then open a project, VS goes stucked and I have to restart it. All above solutions tried with no luck. Env: Win 10 x64 up to date, VS 2015 CE with U1 & Nuget 3.3.0.167 & Azure SDK 2.8.1 |
pete1208
commented
Dec 2, 2015
|
@yishaigalatzer - I could let you have access to this machine via join.me |
yishaigalatzer
commented
Dec 2, 2015
|
@JeremyBP one thing that would be interesting to see is if you have any init.ps1 scripts in your installed nuget packages that are misbehaving. As an experiment can you scan your packages folder for such files and temporarily delete them? (You can always recover by wiping out the packages folder and restoring again). @pete1208 I'm sick today, but I asked @feiling to work with you. Please email me @ y i g a l a t z @ microsoft.com and I'll forward the contact to him |
feiling
commented
Dec 2, 2015
|
@pete1208 please send email to me (feiling at microsoft.com) so that we can figure out how/when I can get access to your machine. |
JeremyBP
commented
Dec 7, 2015
|
@yishaigalatzer any progress about it? |
yishaigalatzer
commented
Dec 7, 2015
|
I guess not for the last few days, since we where all on vacation on Friday. We will sync again today |
JeremyBP
commented
Dec 7, 2015
|
ok |
feiling
commented
Dec 7, 2015
|
The most probable cause seems to that the powershell dlls (System.Management.Automation) that get loaded do not work with nuget. Since we couldn't repro the problem, I created a simple extension that will list all loaded assemblies in VS: Download the file, change the extension to vsix and install it. Then in VS, you can run the new command Tools -> Get Loaded Assemblies to save the list of loaded assemblies into a file. Please run the commands in these scenarios:
You can then upload the output files and we can take a look. You can also compare the version/location of the powershell assemblies (e.g. System.Management.Automation) yourself and probably you can figure out why the wrong versions get loaded. On my machine, the assembly is |
pete1208
commented
Dec 8, 2015
|
When I edit the config it (and things work) get the assembly: System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, location C:\WINDOWS\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35\System.Management.Automation.dll When I don't edit the config: System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, location C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll These are the loaded assemblies with each config per your tool. |
feiling
commented
Dec 8, 2015
|
Could you zip the file C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll and upload it here? If you can't, then pls right click on the dll to get its file version. For reference, the versions on some of my machines are 10.0.10565.0, 10.0.10240.16384. Also, pls upload the solution/project that repros the problem. Also, pls copy the info that you get from VS, Help -> About, then click the "Copy Info" button. |
feiling
commented
Dec 8, 2015
|
@pete1208 Question about the file 'not working default config.txt': Did you create the file after you opened PowerShell console or after you opened the solution? |
pete1208
commented
Dec 8, 2015
|
Version Info: about.txt The other additional requested uploads are here: |
yishaigalatzer
commented
Dec 8, 2015
|
@pete1208 one thing we forgot to ask is, can you please remove the spell checker and sql prompt and see if the problem goes away? Can you poing to the links of these specific extensions in the extension gallery? |
feiling
commented
Dec 8, 2015
|
@pete1208 I remember that the project can be opened successfully. The VS only crashes when you try to open PowerShell Console after that. Right? What we need is the list of loaded assemblies after the project is opened, but before you try to open PowerShell Console. |
pete1208
commented
Dec 9, 2015
|
With VS default config, no spell check or sql prompt. Here is what is loaded with default and project is open (giving the The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception error) default config no SQL spellchk proj opn.txt oh, and VS will crash if the powershell window is opened before you open the project. If it is closed, and you open the project, then open the powershell window, I get the initializer error above. When I add the entries back to the config, all errors go away. If you want, I can copy this virtual machine onto a usb HDD and send to you to debug. Requires VMWare workstation 12. |
zman13
commented
Dec 10, 2015
|
Having a similar problem. Since the RC update if I have the Package Manager Console tab open when I load VS 2013 (or 2015) it seems to initialize fine, but Visual Studio will crash whenever I try to publish our project which has not changed lately. However, if I don't have the Package Manager Console up initially and publish before opening the PMC tab it will publish the project properly but when I try to open the Package Manager Console tab I will get The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception on the top line of the console. Very annoying behavior that was introduced with the update |
yishaigalatzer
commented
Dec 10, 2015
|
@zman13 we are not aware on impacts on 2013 or an update that introduced it. Can you provide more details? What do you mean by publishing? Can you share specifically what is going on? |
yishaigalatzer
reopened this
Dec 10, 2015
zman13
commented
Dec 10, 2015
|
sure, I meant publishing the project. (right clicking on the project and using the publish function in VS). When I choose this option (and I have opened VS with the PMC tab opened) the publish dialog will not come up instead visual studio will crash with a dialog that says: |
feiling
commented
Dec 10, 2015
|
@pete1208 We just couldn't figure out what might be the cause. We'll need access to your machine to debug the problem. Please make a copy of the VM and send it to us at Microsoft Corporation |
pete1208
commented
Dec 10, 2015
|
Will send with info needed to log in, etc... |
yishaigalatzer
added this to the
3.4 milestone
Dec 10, 2015
yishaigalatzer
assigned
feiling
Dec 10, 2015
yishaigalatzer
added
Priority:1
Type:Bug
and removed
Viewed
labels
Dec 10, 2015
lju
commented
Dec 11, 2015
|
So I was having the exact same problem - same error with the same attempts to fix it. I worked around it by closing all instances of VS and then opening the Package Manager Console and then my project within a new instance of VS. The Console now stays up and no longer gives me that error. It's been fine ever since. |
pete1208
commented
Dec 11, 2015
|
Disk with VM is on it's way. When you get it, if you open notepad++ it will have the devenv.conf file we've talked about. I tried Lju's solution, with no luck. |
Erucy
commented
Dec 12, 2015
|
same error as @zman13 . I've reinstalled all the environment I have, reset win10, reinstall vs2015 ent with update 1. Open my web project, click publish, close the dialog, open the package manager console, and then, bang! If I open the package manager console first, well, everything seems fine, until I open the publish dialog, the vs crash... All the softwares I have on my machine are windows 10 x64 ent th2, vs 2015 and office 2016. |
yishaigalatzer
commented
Dec 12, 2015
|
Thank you everyone, the status is that we cannot get a repro in Redmond. @pete1208 has been kind enough to send us a vm, so when it gets to us we will take another look. Our assumption is that "something" is loading the wrong version of powershell into the visual studio host, and since the policy in visual studio is to only load one and that version is not compatible with what nuget is trying to do we fail loading the console. This is an inherent limitation of running inside a host on the same appdomain (which is required by the powershell console to talk directly to the visual studio objects) At this point without a good root cause, or a good repro we are still trying to figure out what is going on. Hopefully when we get the vhd, we will be able to dig deeper. With the holiday season, I unfortunately suspect this might get dragged into early January before we can nail it down. |
JeremyBP
commented
Dec 15, 2015
|
I can confirm that for my environment, everything's working great with nuget/powershell with any kind of project, except with Xamarin.Android project. Don't know if @pete1208 was working with Xamarin to or if it's only about my personal environment. Env: Win 10 x64 up to date, VS 2015 CE with U1 & Nuget 3.3.0.167 & Azure SDK 2.8.1 |
ChekuDotCoDotUk
commented
Dec 15, 2015
|
I'm still seeing this error with Xamarin.Android also... I had just tried Installing the XLab.Forms stuff from Nuget and it seems to have broken the Package Manager Console |
pete1208
commented
Dec 17, 2015
|
I reset the devenv.config back to the default and installed VS2015 Patch 1. The package manager console now works fine. |
igrali
commented
Dec 21, 2015
yishaigalatzer
commented
Dec 21, 2015
Erucy
commented
Dec 22, 2015
|
I just did the workaround as @pete1208 did. It seems make everything fine. |
igrali
commented
Dec 22, 2015
|
Do you mean: do Devenv /ResetSettings and reinstall VS again or? I tried doing Devenv /ResetSettings but that didn't help :( |
yishaigalatzer
commented
Dec 22, 2015
|
Change the config file is the suggestion. |
igrali
commented
Dec 22, 2015
|
Oh, I see. Yeah, it seems that adding those entries to devenv.exe.config solved the problem for me - I was finally able to use Package Manager Console and publish my web app without a crash. Thanks! |
vijayrkn
commented
Dec 23, 2015
|
@pete1208 Thanks for sending us the disk with VM. We will take a look at it. |
vijayrkn
commented
Dec 28, 2015
|
@pete1208 I tried to repro the issue you mentioned on the machine you provided and I can open the publish dialog with Package manager open without any issues. I also tried publishing the project and it works fine. Is there any repro steps that I am missing here? |
yishaigalatzer
commented
Dec 28, 2015
|
Vijay can you run install-package command ? |
pete1208
commented
Dec 28, 2015
|
Did you open notepad++ and remove the lines I added to the config? The current config is a work-around one |
vijayrkn
commented
Dec 29, 2015
Pray4Wind
commented
Dec 30, 2015
|
I had this same error. Very annoying, seemed to appear out of nowhere, then I remembered my machine did one of those lovely "Updates". You know the Poltergeist moment after you go away and come back your screen says, "Hi". Very creepy, Microsoft. Tsk tsk. Well, after poking around some I found this article, which if you follow the steps might solve your problem as well. Essentially, the "update" had jacked with the security settings in some way. I'd really prefer Microsoft not do these "updates" this way. Nonetheless after setting the ExecutionPolicy and restarting VS, all is well. Hope this helps. |
yishaigalatzer
commented
Dec 30, 2015
|
@Pray4Wind thanks, but this looks like an unrelated issue to the one reported it (though very possible, something we do not control). What we are seeing is that there is a stack overflow in the powershell code proper, we have reached out to the power shell team, and we are working on a potential temporary workaround in nuget itself. |
yishaigalatzer
added
the
ClosedAs:External
label
Jan 4, 2016
yishaigalatzer
commented
Jan 4, 2016
|
UPDATE: We figured out this is a bug in System.Management.Automation 3.0 (on the specific image @pete1208 sent us), which is why the solution by @pete1208 (which basically downgrades to System.Management.Automation 1.0) makes it work again. The fix is supposed to be released at some point in January as part of the windows update releases, when that happens we will update this issue with exact details on how to acquire it. |
Bilegbayar
commented
Jan 5, 2016
|
Same here, if package manager console is OK, publish will crash VS without any notice :( |
cpolitz
commented
Jan 8, 2016
|
I am experiencing the exact same issue. If I close visual studio and open it fresh and open PackageManager console first it is fine. But then if I try to publish it crashes. If I open it fresh and publish first, that works fine however now PackageManager Console will error as described. |
reddyBell
commented
Jan 11, 2016
|
Same problem as @cpolitz here. VS2015, Windows 10, started sometime in the last two weeks without any apparent action from my side. |
yishaigalatzer
commented
Jan 11, 2016
|
@Bilegbayar @cpolitz @joeyfr - See above comment, this seems to come from a PowerShell dll that has a bug causing stackoverflow in it. The scenario happens when some new assemblies are being loaded into the main appdomain after this powershell dll is loaded. There is not much NuGet can do about it, until the Power Shell team releases their fix as part of windows update. I don't have an official date, but I believe it should happen this month. |
reddyBell
commented
Jan 11, 2016
|
@yishaigalatzer Thanks mate I didn't get it. Hopefully they will release it soon. |
reddyBell
unassigned
feiling
Jan 11, 2016
Spongman
commented
Jan 11, 2016
|
can you please post detailed instructions on the workaround? what caused this problem, was it windows update? |
yishaigalatzer
commented
Jan 11, 2016
|
@piersh @pete1208 posts a workaround above where we uses binding redirects to force loading powershell 1.0, it is not something we guarantee to work all over, but it seems to be a good bandaid for some people.
Changes to config file: The problem with it is that it loads an older version of powershell for all of visual studio, and we have no idea what side effects it might have. Feel free to try at your own risk. |
jontyt
commented
Jan 13, 2016
|
For anybody wanting an easy get around the nuget console issue - "The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception." Simply reinstalling nuget from Visual studio fixed this issue for me. |
emgarten
referenced this issue
Jan 15, 2016
Closed
The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception. #1932
yishaigalatzer
commented
Jan 21, 2016
|
@pete1208 the fix was released as part of https://support.microsoft.com/en-us/kb/3124263, could you install it and verify the problem is fixed for you? |
pete1208
commented
Jan 22, 2016
|
Yes I am working without errors |
reddyBell
commented
Jan 22, 2016
|
Same here, this has been fixed |
yishaigalatzer
commented
Jan 22, 2016
|
Thanks for validating the fix. This bug was a mystery for a while. Huge thanks to @pete1208 for the help mailing/nailing down a repro |


pete1208 commentedOct 26, 2015
If do not have any solution open, I can open the package manager console. If I then open a solution, VS2015 crashes.
If I restart visual studio with no package manager console open, then open a solution, then choose package manager console, I get the following error:
"The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception."
When this happens I do not get command prompt.
Environment: Win10 32bit, VS2015
Any help would be appreciated.
-Pete