-
Notifications
You must be signed in to change notification settings - Fork 258
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
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? |
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. |
Can you share a solution that crashes for you? |
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? |
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. |
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 |
I've just tried it, and the above workaround allows the entity framework to install, so I'm happy. |
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! |
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 |
@pete1208 any chance we can get access to a machine with this failure? |
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. |
The problem is that we cannot get a local repro. Is it possible to get access to a machine this happens on? |
I was just able to fix this by removing the Nuget extension (via extensions and updates), rebooting, reinstalling it, then rebooting. |
@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. |
@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 |
@yishaigalatzer - I could let you have access to this machine via join.me |
@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 |
@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. |
@yishaigalatzer any progress about it? |
I guess not for the last few days, since we where all on vacation on Friday. We will sync again today |
ok |
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 |
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. |
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. |
@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? |
Version Info: about.txt The other additional requested uploads are here: |
@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? |
@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. |
Do you mean: do Devenv /ResetSettings and reinstall VS again or? I tried doing Devenv /ResetSettings but that didn't help :( |
Change the config file is the suggestion. |
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! 😃 |
@pete1208 Thanks for sending us the disk with VM. We will take a look at it. |
@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? |
Vijay can you run install-package command ? |
Did you open notepad++ and remove the lines I added to the config? The current config is a work-around one |
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. |
@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. |
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. |
Same here, if package manager console is OK, publish will crash VS without any notice :( |
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. |
Same problem as @cpolitz here. VS2015, Windows 10, started sometime in the last two weeks without any apparent action from my side. |
@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. |
@yishaigalatzer Thanks mate I didn't get it. Hopefully they will release it soon. |
can you please post detailed instructions on the workaround? what caused this problem, was it windows update? |
@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. |
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. |
@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? |
Yes I am working without errors |
Same here, this has been fixed |
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 |
install latest nugget package help me solve this issue |
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
The text was updated successfully, but these errors were encountered: