Day 1:
System: Windows 10
Microsoft Visual Studio Community 2017
Version 15.5.5
VisualStudio.15.Release/15.5.5+27130.2026
I have a website project that is making use of the WindowsAzure.Storage NuGet package.
From within Visual Studio, I do the following:
Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution ...
The system displays 2 updates are available:
Newtonsoft.Json v10.0.3 (currently installed v9.0.1)
WindowsAzure.Storage v9.0 (currently installed v8.7)
I select check the "Select all packages" checkbox and click the "Update" button.
FAIL (Never had this happen before) !!
Below is the output captured from Visual Studio:
Retrieving package 'WindowsAzure.Storage 9.0.0' from 'nuget.org'.
...
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3007) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3014) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3021) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3028) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3035) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The term 'Get-ExecutionPolicy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Install failed. Rolling back...
Error List Window shows:
Failed to initialize the PowerShell host. If your PowerShell execution policy setting is set to AllSigned, open the Package Manager Console to initialize the host first.
Powershell output from: Get-ExecutionPolicy -List output:
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Unrestricted
LocalMachine Unrestricted
Is there a problem with the NuGet package itself or my system?
I have never had this issue before and after searching for a solution (none found so far) -- I am at the mercy of the NuGet / Visual Studio gods!
Thanks in advance.
======
Day 2: 8:00 am ...
Trying again... Lets see if we can get the Package Manager Console working...
Start Visual Studio (Community 2017)
TOOLS -> NuGet Package Manager -> Package Manager Console
Which results in the following being displayed:
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3007) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3014) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3021) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3028) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3035) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The term 'Get-ExecutionPolicy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Back to the drawing board! Will continue looking for a solution...
So, let's try Visual Studio Installer...
Launch Visual Studio Installer
Select "More" -> "Repair"
Which results in:
The dependent package cannot be found: Component.PowerShellTools.VS2017,version=3.0.585
I click on "View Log", which displays:
[1cb4:000a][2018-02-17T08:27:06] Error 0x80131500: The dependent package cannot be found: Component.PowerShellTools.VS2017,version=3.0.585
at Microsoft.VisualStudio.Setup.Dependencies.DependencyManager.FindDependentPackages(Dependency dependency, DependencyComparer comparer, Dictionary`2 packageIndex)
at Microsoft.VisualStudio.Setup.Dependencies.DependencyManager.BuildGraphRecursive(IPackage graphRoot, DependencyNode node, DependencyComparer comparer, Dictionary`2 packageIndex, Dictionary`2 nodeIndex, Boolean splitNodes)
at Microsoft.VisualStudio.Setup.Dependencies.DependencyManager.BuildGraphCore(IPackage root, IEnumerable`1 packages, DependencyComparer comparer, Dictionary`2 packageIndex, Dictionary`2 nodeIndex, Boolean splitNodes, DependencyCollection deprecated)
at Microsoft.VisualStudio.Setup.Dependencies.DependencyManager.BuildGraph(IPackage root, IEnumerable`1 packages, Boolean isUpdate, IDependencyComparisonSeed seed, DependencyCollection deprecated)
at Microsoft.VisualStudio.Setup.Engine.GetDependencyGraph(Product product)
at Microsoft.VisualStudio.Setup.Engine.PreChecks(String installationPath, Boolean isLayoutSet, Product product, ExecuteAction bootstrapperAction, ITelemetryOperation operation, IQuery query)
at Microsoft.VisualStudio.Setup.Engine.Repair(CancellationToken token)
Ok - so somehow, my system has lost a dependent package (Component.PowerShellTools.VS2017) -- will try modify to see if I can add the package...
======
Day 2 - 10:15 am (still at it) - current state -- at wits end...
Microsoft Visual Studio Community 2017
Version 15.5.6
VisualStudio.15.Release/15.5.6+27130.2027
Microsoft .NET Framework
Version 4.7.02556
I do the following:
TOOLS -> NuGet Package Manager -> Package Manager Console
Which results in the following being displayed:
If anyone (Microsoft) has a solution -- I would REALLY appreciate it !
======
Day 2: 3:09 pm ...
In one final (desperate) attempt, I Launched Visual Studio Installer
Click on "More" -> "Repair" ....
After a couple of hours Visual Studio was (re)installed:
Microsoft Visual Studio Community 2017
Version 15.5.6
VisualStudio.15.Release/15.5.6+27130.2027
Microsoft .NET Framework
Version 4.7.02556
I then do the following (after lighting 12 candles and chanting "Bill-Bill-Bill")...
TOOLS -> NuGet Package Manager -> NuGet Manager Console
Result:
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3007) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3014) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3021) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3028) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3035) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The term 'Get-ExecutionPolicy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I am doomed -- I cannot use Visual Studio until this is fixed.
======
Day 3 - 7:49 am
I see my issue has been Triaged by MSFT at:
https://developercommunity.visualstudio.com/content/problem/199976/visual-studio-failed-to-initialize-the-powershell.html
Have also tried the "solutions" from these resources:
https://developercommunity.visualstudio.com/content/problem/154563/failed-to-initialize-the-powershell-host.html
https://learn.microsoft.com/en-us/nuget/release-notes/known-issues#opening-package-manager-console-fails-with-objectsecurity-exception
Unfortunately, none of the above have helped to correct this issue.
Most posts indicate a complete re-install of VS may be needed -- good grief!!
Hoping a solution will be found that DOES NOT REQUIRE A COMPLETE RE-INSTALL!
======
Day 3 - 1:54 pm
Gave up ...
UNINSTALLED Visual Studio. Shutdown (powered down system)
Startup (powered up system)
Downloaded Visual Studio installer from
https://www.visualstudio.com/downloads/
Ran Disk Clean app as per installer instructions.
Shutdown (powered down system)
Startup (powered up system)
Ran Visual Studio 2017 Community Installer - success.
Start Visual Studio
TOOLS -> NuGet Package Manager -> Package Manager Console
Result:
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3007) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3014) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3021) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3028) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(3035) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: The getter method should be public, non void, static, and have one parameter of type PSObject.
The term 'Get-ExecutionPolicy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
So - not even a fresh installation of Visual Studio Community is solving this problem !!!!
======
Day 4 - 9:11 am
Late last night I opened a new issue at GitHub re PowerShell, see:
https://github.com/PowerShell/PowerShell/issues/6189
This morning, found a reply and took the suggestion of lzybkr and disabled Powershell V2; I posted the commands for disabling V2 on the GitHub post above.
The good news - I was able to update packages via NuGet again!
The bad news - If I start Visual Studio and then do:
TOOLS -> NuGet Package Manager -> Package Manager Console
The console window opens, but simply hangs with the following message:
Initializing Powershell host...
I STILL have NO idea WHAT is causing this behavior within Visual Studio; but after 4 days, I am just considering myself lucky that I can (once again) update NuGet packages and get back to work.
Although my "issue" of updating NuGet packages has (for the most part) been resolved, I still do not see this as a solution as the root cause of why Visual Studio / NuGet Package Manager Console cannot initialize the PowerShell host has NOT been resolved.
Should anyone find the root cause, please post your solution.
The following finally solved the problem described above:
https://developercommunity.visualstudio.com/content/problem/199976/visual-studio-failed-to-initialize-the-powershell.html
We have finally identified the root cause of the issue, and will be fixing in 15.8 release of Visual Studio.
For now, the possible workarounds for this are:
1) Install .NET 2.0 on your machine, which will install the System.Management.Automation Version=1.0.0
2) Use the binding redirect as suggested by some of the members of the community in devenv.exe.config:
<dependentAssembly>
<assemblyIdentity name="System.Management.Automation" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
<publisherPolicy apply="no" />
</dependentAssembly>
Thanks,
Rohit Agrawal
NuGet Team
I have a sample test project given to developers on my project team to learn how to use automated tests. When I run the set of unit tests that I have, they all pass but I receive the following Warning and Error:
Warning: conflict during test run deployment: deployment item '[...]\WebAppMvc4.dll' directly or indirectly referenced by the test container '[...]\webappmvc4.tests.dll' cannot be deployed to 'WebAppMvc4.dll' because otherwise the file '[...]\WebAppMvc4.dll' would overwrite deployment item '[...]\WebAppMvc4.dll' directly or indirectly referenced by '[...]\webappmvc4.tests.dll'
Error: Cannot initialize the ASP.NET project 'WebAppMvc4'.
Exception was thrown: The web site could not be configured correctly; getting ASP.NET process information failed. Requesting 'http://localhost:12903/VSEnterpriseHelper.axd' returned an error: The remote server returned an error: (500) Internal Server Error.
This is very similar to the problem found here: Test run errors with MSTest in VS2010
However, the resolution to this problem had to do with turning off the Sign The Assembly checkbox in the project properties. Signing is not turned on for this project, and I have not been able to determine the reason for the Warning/Error.
Here is the information from Event Viewer for the Warning:
Event code: 3008
Event message: A configuration error has occurred.
Event time: 6/27/2012 9:40:51 AM
Event time (UTC): 6/27/2012 2:40:51 PM
Event ID: a9b4d9d93e334acbbde6184527b4cd81
Event sequence: 1
Event occurrence: 1
Event detail code: 0
Process information:
Process ID: 4128
Process name: WebDev.WebServer40.EXE
Exception information:
Exception type: ConfigurationErrorsException
Exception message: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
Request information:
Request URL:
http://localhost:12903/VSEnterpriseHelper.axd
And here is the info for the Error:
(QTAgent32.exe, PID 9392, Thread 7) CoveragePlugIn.InitAspNet threw in calling WorkerProcessIdentity or WorkerProcessImpersonatedIdentity for 'WebAppMvc4':
Microsoft.VisualStudio.Enterprise.Common.AspNetHelperException: The web site could not be configured correctly; getting ASP.NET process information failed.
Requesting 'http://localhost:12903/VSEnterpriseHelper.axd' returned an error: The remote server returned an error: (500) Internal Server Error. ---> System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.VisualStudio.Enterprise.Common.BaseHelper.GetWorkerProcessInfo()
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.Enterprise.Common.BaseHelper.GetWorkerProcessInfo()
at Microsoft.VisualStudio.TestTools.CodeCoverage.CoveragePlugIn.InitAspNet(TestRun testRun)
I'm trying to compile existing source code for a network sniffer on my Mac Lion. I installed libpcap. The source includes a header file /usr/include/net/if.h, which is throwing compilation errors as shown below.
Floyd:~ Shastry$ gcc -o arplisten arplisten.c -lpcap
In file included from arplisten.c:4:
/usr/include/net/if.h:265: error: field ‘ifru_addr’ has incomplete type
/usr/include/net/if.h:266: error: field ‘ifru_dstaddr’ has incomplete type
/usr/include/net/if.h:267: error: field ‘ifru_broadaddr’ has incomplete type
/usr/include/net/if.h:308: error: field ‘ifra_addr’ has incomplete type
/usr/include/net/if.h:309: error: field ‘ifra_broadaddr’ has incomplete type
/usr/include/net/if.h:310: error: field ‘ifra_mask’ has incomplete type
/usr/include/net/if.h:393: error: field ‘addr’ has incomplete type
/usr/include/net/if.h:394: error: field ‘dstaddr’ has incomplete type
arplisten.c:6:24: error: netinet/if.h: No such file or directory
arplisten.c: In function ‘main’:
arplisten.c:139: warning: incompatible implicit declaration of built-in function ‘strlen’
Floyd:~ Shastry$
I did a lot of googling for help, in vain. Can someone please help me with this?
It looks like it's the order in which files are included. See this page, which I found via google.
i am getting this error with visual studio 2010 and .net framework 4.0.
Not able to see any relevant solution for this especially with VS2010.
any comments/suggestions pls.
error MSB4018: The "" task failed unexpectedly
error MSB4018: System.FormatException: Input string was not in a correct format.
error MSB4018: at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
error MSB4018: at System.String.Format(IFormatProvider provider, String format, Object[] args)
...
...
...
This is a bug in our code. It will be fixed for the next release. Please see here to help work around it.
What a stupid bug. I have logged it for v4.0. The only workaround I can find short of removing IgnoreStandardErrorWarningFormat is to add a CustomWarningRegularExpression like .*{.* so that you get warnings instead of errors or a crash.