PowerShell / PowerShell/PSScriptAnalyzer

Heads up: (compatibility) rule for dictionary keys IList interface

Open
#1,759 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area - CompatibilityRules Issue - Enhancement Up-for-Grabs
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

Just a heads up:
In the (near?) future, dictionary keys are going to support the IList interface.
This would mean that e.g. @($Dictionary.Keys)[0] can be simplified to $Dictionary.Keys[0].
see: #15843 Ordered Dictionary keys are not numerically indexable and linked .Net issue: #56835 OrderedDictionaryKeyValueCollection implement IList
This might lead to (downwards) compatibility issues, therefore a (compatibility) rule for this (future) enhancement could make sense.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading compatibility issue #805, PowerShell issue #15843, and the linked .NET issue #56835 to understand the proposed IList behavior and compatibility concern. Define the rule's intended warning and acceptance criteria for dictionary key indexing; completion would require an agreed design and corresponding analyzer coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.