OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 190 forks source link

PowerShell Core 6.1.1 x64/x86 side by side installation. #400

Open lcizzle opened 5 years ago

lcizzle commented 5 years ago

(Was told to move my issue here) I have installed 6.1.1 x64 and x86 msi on a fresh install of Windows 10 1803. The installation process was ok, no errors. I opened the x64 version and ran Get-PackageProvider, returned expected results. Opened the x86 version and ran Get-PackageProvider and received an unhandled exception.

> Get-PackageProvider
Get-PackageProvider : Unhandled Exception - Message:'The type initializer for 'Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType' threw an exception.' Name:'TypeInitializationException' Stack Trace:'   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType.Create(Type tInterface, OrderedDictionary`2 instanceMethods, List`2 delegateMethods, List`1 stubMethods, List`2 usedInstances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.CreateProxy(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast[TInterface](Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterfaceExtensions.As[TInterface](Object instance)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.get_PackageManagementHost()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.SelectProviders(String[] names)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider.ProcessRecordAsync()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.AsyncCmdlet.<>c__DisplayClass83_0.<AsyncRun>b__0()'
At line:1 char:1
+ Get-PackageProvider
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Microsoft.Power...PackageProvider:GetPackageProvider) [Get-PackageProvider], Exception
+ FullyQualifiedErrorId : UnhandledException,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider
SCuffy commented 5 years ago

Experienced same NuGet installation failure with 6.1.1 x64 and x86 msi on a fresh Win 10 1809. Downgraded to 6.0.5 which worked with no errors.

edyoung commented 5 years ago

That's a strange one. I have installed 6.1.1 x64 and x86 on the same computer, but so far I can't reproduce this problem. Can you provide results from:

 $psversiontable
Get-Module # in the x86 window where the failure happens
Get-PackageProvider # in the x64 window
SCuffy commented 5 years ago

OK weird, it's working for me now. Got to love a transient error!

lcizzle commented 5 years ago

Not sure why you would close this. Doesn't work for me and I even formatted.

PS C:\Users\Daedalus> $psversiontable

Name                           Value
----                           -----
PSVersion                      6.1.1
PSEdition                      Core
GitCommitId                    6.1.1
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0`

`PS C:\Users\Daedalus> Get-Module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemPropert...
Manifest   6.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     2.0.0      PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS...
`
`PS C:\Users\Daedalus> Get-PackageProvider

Name                     Version          DynamicOptions
----                     -------          --------------
NuGet                    2.8.5.210        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet            1.6.7.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
alerickson commented 5 years ago

@lcizzle I apologize for preemptively closing this issue.
I haven't been able to repro this on my own. I'm getting the same results as your those in your last comment, except that Get-Module also returns Script 1.1.7.2 PackageManagement {Find-Package, Find-PackageProvider, Get-Package, Get-Pack... PowerShellCore ships with PackageManagement, so I'm a bit surprised it's not returning on your machines.

I'm also curious if you're experencing the same issue with newer versions of PowerShellCore?

lcizzle commented 5 years ago

@alerickson Let me check the latest preview version and post back.

lcizzle commented 5 years ago

@alerickson I uninstalled both x86 and x64 6.1.1. Installed only x86 6.2.0 preview 3.

`PowerShell 6.2.0-preview.3
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS C:\Users\Daedalus> Get-PackageProvider
Get-PackageProvider : Unhandled Exception - Message:'The type initializer for 'Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType' threw an exception.' Name:'TypeInitializationException' Stack Trace:'   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType.Create(Type tInterface, OrderedDictionary`2 instanceMethods, List`2 delegateMethods, List`1 stubMethods, List`2 usedInstances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.CreateProxy(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast[TInterface](Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterfaceExtensions.As[TInterface](Object instance)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.get_PackageManagementHost()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.SelectProviders(String[] names)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider.ProcessRecordAsync()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.AsyncCmdlet.<>c__DisplayClass83_0.<AsyncRun>b__0()'
At line:1 char:1
+ Get-PackageProvider
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Microsoft.Power...PackageProvider:GetPackageProvider) [Get-PackageProvider], Exception
+ FullyQualifiedErrorId : UnhandledException,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider

PS C:\Users\Daedalus>
lcizzle commented 5 years ago

Windows 10 - 1809 17763.195 Maybe the issue is specific to this version of Windows 10?

dancs85 commented 5 years ago

I am also getting the same error while running "Get-PackageProvider":

Get-PackageProvider : Unhandled Exception - Message:'The type initializer for 'Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType' threw an exception.' Name:'TypeInitializationException' Stack Trace:'   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType.Create(Type tInterface, OrderedDictionary`2 instanceMethods, List`2 delegateMethods, List`1 stubMethods, List`2 usedInstances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.CreateProxy(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast[TInterface](Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterfaceExtensions.As[TInterface](Object instance)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.get_PackageManagementHost()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.SelectProviders(String[] names)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider.ProcessRecordAsync()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.AsyncCmdlet.<>c__DisplayClass83_0.<AsyncRun>b__0()'
At line:1 char:1
+ Get-PackageProvider
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Microsoft.Power...PackageProvider:GetPackageProvider) [Get-PackageProvider], Exception
+ FullyQualifiedErrorId : UnhandledException,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider

I only have PowerShell 6 x86 installed:

Name                           Value
----                           -----
PSVersion                      6.1.1
PSEdition                      Core
GitCommitId                    6.1.1
OS                             Microsoft Windows 10.0.17134
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Windows 10: 1803 build 17134.523

WietseMank commented 5 years ago

I'm using Windows 10 Pro: 1809 build 17763.404

I only have Powershell 6 x86 installed:

Name                           Value
----                           -----
PSVersion                      6.2.0
PSEdition                      Core
GitCommitId                    6.2.0
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

And I get the same error:

Get-PackageProvider : Unhandled Exception - Message:'The type initializer for 'Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType' threw an exception.' Name:'TypeInitializationException' Stack Trace:'   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType.Create(Type tInterface, OrderedDictionary`2 instanceMethods, List`2 delegateMethods, List`1 stubMethods, List`2 usedInstances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.CreateProxy(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast[TInterface](Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterfaceExtensions.As[TInterface](Object instance)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.get_PackageManagementHost()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.SelectProviders(String[] names)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider.ProcessRecordAsync()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.AsyncCmdlet.<>c__DisplayClass83_0.<AsyncRun>b__0()'
At line:1 char:1
+ Get-PackageProvider
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Microsoft.PowerShel\u2026.GetPackageProvider:GetPackageProvider) [Get-PackageProvider], Exception
+ FullyQualifiedErrorId : UnhandledException,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider

But only when I run Powershell 6 x86 as administrator. If I start Powershell 6 x86 normally I get no errors:

Name                     Version          DynamicOptions
----                     -------          --------------
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, …
PowerShellGet            2.1.2.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, In…

I hope this helps

MarkusAmshove commented 5 years ago

Getting the same error after fresh Windows 10 and PowerShell Core (x64) install:

Name                           Value
----                           -----
PSVersion                      6.2.2
PSEdition                      Core
GitCommitId                    6.2.2
OS                             Microsoft Windows 10.0.18922
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
12:19:28 markus@desktop-markus:[~\Documents\PowerShell] $ Get-PackageProvider
Get-PackageProvider : Unhandled Exception - Message:'The type initializer for 'Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType' threw an exception.' Name:'TypeInitializationException' Stack Trace:'   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType.Create(Type tInterface, OrderedDictionary`2 instanceMethods, List`2 delegateMethods, List`1 stubMethods, List`2 usedInstances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.CreateProxy(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast[TInterface](Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterfaceExtensions.As[TInterface](Object instance)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.get_PackageManagementHost()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.SelectProviders(String[] names)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider.ProcessRecordAsync()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.AsyncCmdlet.<>c__DisplayClass83_0.<AsyncRun>b__0()'
At line:1 char:1
+ Get-PackageProvider
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Microsoft.PowerShel\u2026.GetPackageProvider:GetPackageProvider) [Get-PackageProvider], Exception
+ FullyQualifiedErrorId : UnhandledException,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageProvider

Command works fine on "normal" PowerShell (the not Core :-))

SydneyhSmith commented 5 years ago

It would be helpful to know the output of Get-Package PackageManagement as well as the $env:PSModulePath and if there are any contents in your file system under your PSModulePath

MarkusAmshove commented 5 years ago
07:58:07 markus@desktop-markus:[~\dotfiles] [master ≡] $ Get-Package PackageManagement
Get-Package : Unhandled Exception - Message:'The type initializer for 'Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType' threw an exception.' Name:'TypeInitializationException' Stack Trace:'   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType.Create(Type tInterface, OrderedDictionary`2 instanceMethods, List`2 delegateMethods, List`1 stubMethods, List`2 usedInstances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.CreateProxy(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast(Type tInterface, Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterface.DynamicCast[TInterface](Object[] instances)
   at Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicInterfaceExtensions.As[TInterface](Object instance)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.get_PackageManagementHost()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletBase.SelectProviders(String[] names)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletWithProvider.get_SelectedProviders()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletWithProvider.<get_CachedSelectedProviders>b__23_0()
   at Microsoft.PackageManagement.Internal.Utility.Extensions.DictionaryExtensions.GetOrAdd[TKey,TValue](IDictionary`2 dictionary, TKey key, Func`1 valueFunction)
   at Microsoft.PackageManagement.Internal.Utility.Extensions.Singleton`1.GetOrAdd(Func`1 newInstance, Object primaryKey, Object[] keys)
   at Microsoft.PackageManagement.Internal.Utility.Extensions.SingletonExtensions.GetOrAdd[TResult](Object primaryKey, Func`1 newInstance, Object[] keys)
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletWithProvider.get_CachedSelectedProviders()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.CmdletWithProvider.GenerateDynamicParameters()
   at Microsoft.PowerShell.PackageManagement.Cmdlets.AsyncCmdlet.<>c__DisplayClass83_0.<AsyncRun>b__0()'
At line:1 char:1
+ Get-Package PackageManagement
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Microsoft.PowerShel\u2026.Cmdlets.GetPackage:GetPackage) [Get-Package], Exception
+ FullyQualifiedErrorId : UnhandledException,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackage
07:58:00 markus@desktop-markus:[~\dotfiles] [master ≡] $ $env:PSModulePath -split ";" | %{ ls $_ }

    Directory C:\Users\Markus\Documents\PowerShell\Modules

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       19.07.2019     19:33                Configuration
d-----       19.07.2019     19:33                DefaultParameter
d-----       19.07.2019     19:33                Environment
d-----       19.07.2019     19:33                Get-ChildItemColor
d-----       21.07.2019     12:30                posh-docker
d-----       19.07.2019     19:33                posh-git
d-----       19.07.2019     19:33                PoshGrep
d-----       19.07.2019     19:33                Profile
d-----       19.07.2019     19:33                PSFzf

    Directory C:\Program Files\WindowsPowerShell\Modules

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       19.07.2019     19:02                Microsoft.PowerShell.Operation.Validation
d-----       19.07.2019     19:02                PackageManagement
d-----       19.07.2019     19:02                Pester
d-----       21.07.2019     12:28                posh-docker
d-----       19.07.2019     19:02                PowerShellGet
d-----       19.07.2019     19:02                PSReadline

    Directory C:\Program Files\PowerShell\6\Modules

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       19.07.2019     19:32                CimCmdlets
d-----       19.07.2019     19:32                Microsoft.PowerShell.Archive
d-----       19.07.2019     19:32                Microsoft.PowerShell.Diagnostics
d-----       19.07.2019     19:32                Microsoft.PowerShell.Host
d-----       19.07.2019     19:32                Microsoft.PowerShell.Management
d-----       19.07.2019     19:32                Microsoft.PowerShell.Security
d-----       19.07.2019     19:32                Microsoft.PowerShell.Utility
d-----       19.07.2019     19:32                Microsoft.WSMan.Management
d-----       19.07.2019     19:32                PackageManagement
d-----       19.07.2019     19:32                PowerShellGet
d-----       19.07.2019     19:32                PSDesiredStateConfiguration
d-----       19.07.2019     19:32                PSDiagnostics
d-----       19.07.2019     19:32                PSReadLine
d-----       19.07.2019     19:32                ThreadJob

    Directory C:\Windows\System32\WindowsPowerShell\v1.0\Modules

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d---s-       19.07.2019     19:02                AppBackgroundTask
d---s-       19.07.2019     19:02                AppLocker
d---s-       19.07.2019     19:04                AppvClient
d-----       19.07.2019     19:04                Appx
d-----       19.07.2019     19:04                AssignedAccess
d---s-       19.07.2019     19:04                BitLocker
d---s-       19.07.2019     19:02                BitsTransfer
d---s-       19.07.2019     19:02                BranchCache
d-----       19.07.2019     19:02                CimCmdlets
d---s-       19.07.2019     19:04                ConfigCI
d-----       19.07.2019     19:02                Defender
d---s-       19.07.2019     19:02                DeliveryOptimization
d-----       19.07.2019     19:02                DirectAccessClientComponents
d-----       19.07.2019     19:04                Dism
d-----       19.07.2019     19:02                DnsClient
d-----       19.07.2019     19:02                EventTracingManagement
d---s-       19.07.2019     19:17                HgsClient
d-----       19.07.2019     19:17                HgsDiagnostics
d-----       19.07.2019     19:17                HostNetworkingService
d-----       19.07.2019     19:17                Hyper-V
d---s-       19.07.2019     19:02                International
d-----       19.07.2019     19:02                iSCSI
d-----       19.07.2019     19:02                ISE
d---s-       19.07.2019     19:04                Kds
d-----       19.07.2019     19:04                Microsoft.PowerShell.Archive
d-----       19.07.2019     19:02                Microsoft.PowerShell.Diagnostics
d-----       19.07.2019     19:02                Microsoft.PowerShell.Host
d-----       19.07.2019     19:02                Microsoft.PowerShell.LocalAccounts
d-----       19.07.2019     19:02                Microsoft.PowerShell.Management
d-----       19.07.2019     19:04                Microsoft.PowerShell.ODataUtils
d-----       19.07.2019     19:02                Microsoft.PowerShell.Security
d-----       19.07.2019     19:02                Microsoft.PowerShell.Utility
d-----       19.07.2019     19:02                Microsoft.WSMan.Management
d---s-       19.07.2019     19:02                MMAgent
d-----       19.07.2019     19:04                MsDtc
d-----       19.07.2019     19:02                NetAdapter
d-----       19.07.2019     19:02                NetConnection
d-----       19.07.2019     19:02                NetEventPacketCapture
d-----       19.07.2019     19:02                NetLbfo
d-----       19.07.2019     19:02                NetNat
d-----       19.07.2019     19:02                NetQos
d-----       19.07.2019     19:03                NetSecurity
d-----       19.07.2019     19:02                NetSwitchTeam
d-----       19.07.2019     19:02                NetTCPIP
d-----       19.07.2019     19:02                NetworkConnectivityStatus
d-----       19.07.2019     19:04                NetworkSwitchManager
d-----       19.07.2019     19:02                NetworkTransition
d-----       19.07.2019     19:02                PcsvDevice
d-----       19.07.2019     19:04                PersistentMemory
d---s-       19.07.2019     19:04                PKI
d-----       19.07.2019     19:02                PnpDevice
d-----       19.07.2019     19:02                PrintManagement
d---s-       19.07.2019     19:03                ProcessMitigations
d-----       19.07.2019     19:02                Provisioning
d---s-       19.07.2019     19:04                PSDesiredStateConfiguration
d-----       19.07.2019     19:02                PSDiagnostics
d-----       19.07.2019     19:02                PSScheduledJob
d-----       19.07.2019     19:02                PSWorkflow
d-----       19.07.2019     19:02                PSWorkflowUtility
d-----       19.07.2019     19:02                ScheduledTasks
d---s-       19.07.2019     19:04                SecureBoot
d---s-       19.07.2019     19:03                SmbShare
d-----       19.07.2019     19:02                SmbWitness
d-----       19.07.2019     19:02                StartLayout
d-----       19.07.2019     19:02                Storage
d-----       19.07.2019     19:02                StorageBusCache
d---s-       19.07.2019     19:04                TLS
d-----       19.07.2019     19:03                TroubleshootingPack
d---s-       19.07.2019     19:04                TrustedPlatformModule
d---s-       19.07.2019     19:02                UEV
d-----       19.07.2019     19:04                VpnClient
d-----       19.07.2019     19:02                Wdac
d---s-       19.07.2019     19:03                Whea
d-----       19.07.2019     19:02                WindowsDeveloperLicense
d-----       19.07.2019     19:02                WindowsErrorReporting
d-----       19.07.2019     19:04                WindowsSearch
d-----       19.07.2019     19:02                WindowsUpdate
d-----       19.07.2019     19:02                WindowsUpdateProvider
SydneyhSmith commented 5 years ago

@MarkusAmshove admittedly we are at a bit of a loss at what the issue is here...the best option is probably to completely uninstall and reinstall PackageManagement as it seems something is not behaving properly with the PackageManagament that came natively with your version of PowerShell...since PackageManagement is not functioning I would also recommend that you do the uninstallation and reinstallation manually....another option would be to try installing the latest version of PowerShell which will also have a newer version of PackageManagement dependency...thanks for your responses!

MarkusAmshove commented 5 years ago

So, what exactly do I do next? :-)

How I got to this issue:

  1. Freshly install Windows 10
  2. Install current release version of PowerShell Core

Thats all :-)

However, the "normal" PowerShell doesn't have this issue, as I just checked, this is the output:

PS C:\Users\Markus> Get-Module PackageManagement

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.1    PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider...}

PS C:\Users\Markus> Get-PackageProvider

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipV...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filter, Tag, Includes, Ds...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

So it either has to do with PowerShell Core or both PowerShell Modules interfering with each other?

I tried to Install-Module PackageManagement within PowerShell Core and got the following:

grafik

SteveL-MSFT commented 5 years ago

@MarkusAmshove if you switch to en-US, does it still repro? Trying to figure out how we can repro this locally

MarkusAmshove commented 5 years ago

Would I have to change the whole system language or is a environment variable enough? Is so, which should I use? :-)

interfacemirror commented 4 years ago

Any solution for this? I installed PS 6.2.3 x86 and not able to do anything. The core PS shipped with Windows works fine but the newer version seems to be annoyed by any command.

Yllzarith commented 4 years ago

I just experienced this type initializer unhandled exception when using Get-PackageProvider, and after trying Install-Module which would call for the NuGet package provider to be installed and fail with the same or similar error when I selected [Y]es to install it. This is on Windows 10 1809 (build 17763.864) with PowerShell Core 6.2.3 x86, having just installed it via the MSI downloaded from the asset list at https://github.com/PowerShell/PowerShell/releases/tag/v6.2.3. This installed alongside Windows PowerShell 5.1, where Get-PackageProvider worked fine:

image

I resolved it by clearing the following two values I had in the PSModulePath system environment variable, then restarted PowerShell Core: %ProgramFiles%\WindowsPowerShell\Modules %SystemRoot%\system32\WindowsPowerShell\v1.0\Modules

Now that I've resolved it I can't replicate the error again. I tried putting those values back in the PSModulePath, and un- and re-installed PS Core, and the issue has not reoccurred.

paschott commented 4 years ago

Having this issue with PowerShell 6.2.4. I've uninstalled/reinstalled, restarted, repaired. I keep getting issues trying to run install-package. It starts with a problem with "nuget" then I get errors like "Install-PackageProvider : Unhandled Exception - Message:'The type initializer for 'Microsoft.PackageManagement.Internal.Utility.Plugin.DynamicType' threw an exception."

I can (at the moment) install packages using PS 7-rc3, but I have no idea why the nuget provider isn't working. The path to the DLL seems to be correct and the file exists.

alerickson commented 4 years ago

@paschott what version of nuget are you using?

paschott commented 4 years ago

Good question. As far as I can tell, it's at least the version required for this to work and the same DLL that works w/ PS 7. I just reinstalled 6 and installed 7rc3. Now 7 works, but 6 doesn't.


From: alerickson notifications@github.com Sent: Monday, February 24, 2020 1:51 PM To: OneGet/oneget oneget@noreply.github.com Cc: Peter Schott paschott@outlook.com; Mention mention@noreply.github.com Subject: Re: [OneGet/oneget] PowerShell Core 6.1.1 x64/x86 side by side installation. (#400)

@paschotthttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpaschott&data=02%7C01%7C%7C0cdd3d7c71764114abf508d7b962f54f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637181706972544060&sdata=0q9%2FaAnTgOLZFZZoYVWEXuClqxD%2BbRVbFpT3qe2ThaI%3D&reserved=0 what version of nuget are you using?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FOneGet%2Foneget%2Fissues%2F400%3Femail_source%3Dnotifications%26email_token%3DAACTI52N2FETLUL4M2NZWM3REQQMRA5CNFSM4GDSMN3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMZJJPQ%23issuecomment-590517438&data=02%7C01%7C%7C0cdd3d7c71764114abf508d7b962f54f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637181706972554054&sdata=mrXFN3MRjAsfwseRDpuc89OWrO4WVX%2Ff1FECFzVI7Lc%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAACTI55IQF4M4AKQAB66RI3REQQMRANCNFSM4GDSMN3A&data=02%7C01%7C%7C0cdd3d7c71764114abf508d7b962f54f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637181706972554054&sdata=0%2Fy1bb7dJRE9muT9qbn39jMDOKQV3Ptn5goz%2BKm4zdE%3D&reserved=0.