PowerShellTraps is a collection of some PowerShell traps and oddities shown by demo scripts, workarounds, and automated tests. On invoking scripts change to their directory. See also TESTS. Some scripts require Invoke-PowerShell.ps1.
- Basic
- And-and-or-have-same-precedence
- App-with-error-output
- Automatic-variables
- Break-and-Continue-with-not-matching-label
- Break-and-Continue-without-loop
- Collection-property-enumeration
- Comparison-operators-with-collections
- Compound-assignment-operators
- Count-and-Length
- Dictionary-Count-Keys-Values
- Different-kinds-of-null
- Double-quoted-string
- DynamicParam
- Enums-evaluated-to-true
- Errors-of-unusual-type
- FormatEnumerationLimit
- Function-invoked-like-method
- Invocation-with-odd-paths
- LastExitCode
- Local-ActionPreference
- Misleading-error-location
- Missing-ternary-operator
- Negative-number-literal-argument
- Null-converted-to-empty-string
- Number-of-returned-objects
- Operators-match-notmatch-and-matches
- Operators-with-equal-precedence
- Properties-of-IDictionary
- Properties-of-XmlNode
- Provider-specific-Filter
- PSCustomObject
- PSReference
- Requires
- RunspacePool
- Statements-are-not-expressions
- Strict-mode-ErrorRecord-formatting
- String-constructor
- String-equality-operators
- Switch-is-a-looping-construct
- Tempting-wrong-operators
- Throw-may-not-terminate
- ThrowTerminatingError
- Too-simple-function-names
- Trap-creates-a-new-scope
- Trap-with-continue
- Trap-with-no-break-or-continue
- Try-and-trap-catch-terminating-errors
- Unexpected-output
- Unexpected-overloaded-method
- Unrolled-collections
- v5-Method-New
- ValidateScript-attribute
- ValueFromPipeline
- ValueFromRemainingArguments
- When-Process-block-is-called
- WildcardPattern
- Class
- Clixml
- Cmdlets
- ConvertFrom-Csv
- ConvertFrom-Json
- ConvertTo-Json
- Copy-Item
- ForEach-Object
- Get-ChildItem
- Get-Event
- Get-Item
- Get-ItemPropertyValue
- Get-Unique
- Get-WmiObject
- Group-Object
- Import-Csv
- Import-Module
- Invoke-Expression
- Invoke-RestMethod
- Join-Path
- Read-Host
- Remove-Item
- Remove-ItemProperty
- Rename-Item
- Resolve-Path
- Select-Xml
- Set-Content
- Split-Path
- Start-Process
- Test-Path
- Wait-Process
- Where-Object
- Write-Debug
- Write-Progress
- Module
- PowerShell.exe
- Exit-code-0-with-Command-syntax-error
- Exit-code-0-with-File-script-error
- Exit-code-5-with-File-1-with-Command
- Exit-code-depends
- Global-and-script-scope
- Not-current-version
- Positional-Command-File
- Switch-parameter-with-value
- Unexpected-start-location
- v3-Interactive-issues
- Version-parameter
- Version-scriptblock-host-problem