Fix `IDE0049` in `System.Management.Automation`. Part 4 by xtqqczze · Pull Request #27380 · PowerShell/PowerShell
Pull request overview
This PR continues the IDE0049 style cleanup in System.Management.Automation remoting code by replacing framework type names (e.g., Int32, UInt32, Int64, String, UInt16) with the equivalent C# language keywords (e.g., int, uint, long, string, ushort) in casts, constants, and attributes.
Changes:
- Update ETW/logging casts to use
long/uintkeywords. - Replace
Int32.MaxValue/UInt32.MaxValue/UInt16.MaxValue/String.Joinusage withint.MaxValue/uint.MaxValue/ushort.MaxValue/string.Join. - Apply keyword-based type usage in a few overridden members/locals for consistency.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/System.Management.Automation/engine/remoting/fanin/PriorityCollection.cs | Uses long/uint keyword casts in ETW logging for received fragments. |
| src/System.Management.Automation/engine/remoting/fanin/BaseTransportManager.cs | Uses uint.MaxValue constant and uint keyword casts for ETW logging fields. |
| src/System.Management.Automation/engine/remoting/common/fragmentor.cs | Uses long/uint keyword casts in ETW logging for sent fragments. |
| src/System.Management.Automation/engine/remoting/common/RunspaceConnectionInfo.cs | Uses int.MaxValue and string.Join keywords for timeouts and argv parsing. |
| src/System.Management.Automation/engine/remoting/commands/getrunspacecommand.cs | Uses ushort.MaxValue in ValidateRange for Port. |
| src/System.Management.Automation/engine/remoting/commands/WaitJob.cs | Uses int.MaxValue in ValidateRange for Timeout. |
| src/System.Management.Automation/engine/remoting/commands/StartJob.cs | Uses int keyword in overridden ThrottleLimit signature. |
| src/System.Management.Automation/engine/remoting/commands/PSRemotingCmdlet.cs | Uses ushort.MaxValue in ValidateRange for Port and long keyword for error parsing local. |
| src/System.Management.Automation/engine/remoting/commands/InvokeCommandCommand.cs | Uses ushort.MaxValue in ValidateRange for Port. |
| src/System.Management.Automation/engine/remoting/client/RemotingProtocol2.cs | Uses int.MaxValue in NonBlockingRead calls. |