PowerShell / PowerShell/PSResourceGet
Install-PSResource throws Operation is not valid due to the current state of the object
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 576
- Forks
- 114
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 7
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
I am experiencing an issue when installing a PowerShell module. When a module is installed while elevated, and then tries to reinstall it under an unelevated session, the error: Operation is not valid due to the current state of the object is thrown. This is quite ambiguous and should error out because it is not elevated.
Expected behavior
Throw an error that access is denied
Actual behavior
Operation is not valid due to the current state of the object
Error details
Environment data
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 1.1.0 preview1 Microsoft.PowerShell.PSResourceGet {Find-PSResource, Get-InstalledPSResource, Get-PS…
Key : PSVersion
Value : 7.4.7
Name : PSVersion
Key : PSEdition
Value : Core
Name : PSEdition
Key : GitCommitId
Value : 7.4.7
Name : GitCommitId
Key : OS
Value : Microsoft Windows 10.0.19045
Name : OS
Key : Platform
Value : Win32NT
Name : Platform
Key : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name : PSCompatibleVersions
Key : PSRemotingProtocolVersion
Value : 2.3
Name : PSRemotingProtocolVersion
Key : SerializationVersion
Value : 1.1.0.1
Name : SerializationVersion
Key : WSManStackVersion
Value : 3.0
Name : WSManStackVersion
Visuals
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Install-PSResource reinstall scenario on Windows with PSResourceGet 1.1.0-preview1, comparing elevated and unelevated sessions. Trace where the ambiguous state error is produced and make the completed behavior report access denied for the unelevated install attempt.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100