Skip to content

Rename *.Win32.cs files to *.Windows.cs under src/libraries#126450

Merged
adamsitnik merged 12 commits intomainfrom
copilot/rename-win32-to-windows-files
Apr 2, 2026
Merged

Rename *.Win32.cs files to *.Windows.cs under src/libraries#126450
adamsitnik merged 12 commits intomainfrom
copilot/rename-win32-to-windows-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Renames all *.Win32.cs files under src/libraries to *.Windows.cs. If a corresponding *.Windows.cs already exists, the content of the *.Win32.cs file is merged into it.

win32.cs vs. windows.cs is a historic leftover from the times when Windows Store apps were not able to use the full Win32 API surface. It does not make sense anymore.

Changes

Simple renames (git history preserved via git mv):

  • FileSystemWatcher.Win32.csFileSystemWatcher.Windows.cs
  • Helper.Win32.csHelper.Windows.cs
  • SerialPort.Win32.csSerialPort.Windows.cs
  • HijriCalendar.Win32.csHijriCalendar.Windows.cs
  • TimeZoneInfo.Win32.csTimeZoneInfo.Windows.cs

Merges (Win32.cs content merged into existing Windows.cs, then Win32.cs deleted):

  • Process.Win32.cs → merged into Process.Windows.cs
  • ProcessManager.Win32.cs → merged into ProcessManager.Windows.cs
  • ProcessStartInfo.Win32.cs → merged into ProcessStartInfo.Windows.cs
  • NamedPipeServerStream.Win32.cs → merged into NamedPipeServerStream.Windows.cs
  • SerialStream.Win32.cs → merged into SerialStream.Windows.cs
  • Environment.Win32.cs → merged into Environment.Windows.cs

Build/project file updates:

  • Updated all .csproj/.projitems references
  • Merged duplicate '$(TargetPlatformIdentifier)' == 'windows' ItemGroup blocks in System.Diagnostics.Process.csproj
  • Fixed broken test project reference in System.IO.IsolatedStorage.Tests.csproj (Helper.Win32.csHelper.Windows.cs)

Code style fixes (per review feedback):

  • Moved all fields to the top of their classes in changed files (Process.Windows.cs, ProcessManager.Windows.cs, Environment.Windows.cs) to conform with coding guidelines
  • Fixed MainWindowFinder struct indentation in ProcessManager.Windows.cs
  • Sorted using directives and fixed missing blank lines in Environment.Windows.cs

Documentation:

  • Updated docs/coding-guidelines/cross-platform-guidelines.md to use Windows.cs naming convention in the example

Note

This PR was created with the assistance of GitHub Copilot.

Copilot AI and others added 2 commits April 2, 2026 05:44
- Simple renames (git mv):
  - FileSystemWatcher.Win32.cs → FileSystemWatcher.Windows.cs
  - Helper.Win32.cs → Helper.Windows.cs
  - SerialPort.Win32.cs → SerialPort.Windows.cs
  - HijriCalendar.Win32.cs → HijriCalendar.Windows.cs
  - TimeZoneInfo.Win32.cs → TimeZoneInfo.Windows.cs

- Merges into existing *.Windows.cs files:
  - Process.Win32.cs → Process.Windows.cs
  - ProcessManager.Win32.cs → ProcessManager.Windows.cs
  - ProcessStartInfo.Win32.cs → ProcessStartInfo.Windows.cs
  - NamedPipeServerStream.Win32.cs → NamedPipeServerStream.Windows.cs
  - SerialStream.Win32.cs → SerialStream.Windows.cs
  - Environment.Win32.cs → Environment.Windows.cs

- Update all csproj/projitems references accordingly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
@github-actions

This comment has been minimized.

Copilot AI requested a review from jkotas April 2, 2026 06:23
@jkotas jkotas marked this pull request as ready for review April 2, 2026 06:26
Copilot AI review requested due to automatic review settings April 2, 2026 06:26
@jkotas
Copy link
Copy Markdown
Member

jkotas commented Apr 2, 2026

@adamsitnik This is fixing an artificial split of Windows-specific implementation for Process and a few other types that makes it hard to navigate the code (for me at least). This artificial split is left-over from the times when Windows Store apps were not allowed to use most Win32 APIs.

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes Windows-specific source file naming under src/libraries by renaming *.Win32.cs files to *.Windows.cs, merging content where *.Windows.cs already existed, and updating project item includes accordingly. This reduces historical ambiguity around “Win32 vs Windows” naming and aligns with current platform-specific file conventions.

Changes:

  • Renamed / merged multiple Windows-specific partial implementation files from *.Win32.cs to *.Windows.cs.
  • Updated .csproj and .projitems compile includes to match the new filenames (and removed deleted *.Win32.cs entries).
  • Updated cross-platform coding guidelines documentation examples to reflect the *.Windows.cs convention.

Reviewed changes

Copilot reviewed 19 out of 24 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Windows.cs New Windows-specific implementation file (renamed from Win32 variant).
src/libraries/System.Private.CoreLib/src/System/Globalization/HijriCalendar.Windows.cs New Windows-specific Hijri calendar registry logic file.
src/libraries/System.Private.CoreLib/src/System/Environment.Windows.cs Merged Windows registry/env-var logic into the Windows file.
src/libraries/System.Private.CoreLib/src/System/Environment.Win32.cs Deleted after merge into Environment.Windows.cs.
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems Updated compile includes to reference *.Windows.cs files.
src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Windows.cs Merged Win32-only helper (OpenPort) into Windows file.
src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Win32.cs Deleted after merge into SerialStream.Windows.cs.
src/libraries/System.IO.Ports/src/System/IO/Ports/SerialPort.Windows.cs New Windows-specific SerialPort implementation file.
src/libraries/System.IO.Ports/src/System.IO.Ports.csproj Updated compile includes to use *.Windows.cs filenames.
src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs Merged Win32-only helper into Windows file.
src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Win32.cs Deleted after merge into NamedPipeServerStream.Windows.cs.
src/libraries/System.IO.Pipes/src/System.IO.Pipes.csproj Removed deleted *.Win32.cs compile include.
src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/Helper.Windows.cs New Windows-specific helper file (renamed from Win32 variant).
src/libraries/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj Updated compile include to Helper.Windows.cs.
src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Windows.cs New Windows-specific watcher implementation file (renamed from Win32 variant).
src/libraries/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj Updated compile include to FileSystemWatcher.Windows.cs.
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Windows.cs Merged Win32-only Verbs implementation into Windows file.
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Win32.cs Deleted after merge into ProcessStartInfo.Windows.cs.
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Windows.cs Merged Win32-only helpers (main window + module/process info).
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs Deleted after merge into ProcessManager.Windows.cs.
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs Merged Win32-only fields/helpers into Windows file.
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs Deleted after merge into Process.Windows.cs.
src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj Removed redundant Windows-only ItemGroup after consolidating includes.
docs/coding-guidelines/cross-platform-guidelines.md Updated naming guidance example to use *.Windows.cs.

jkotas and others added 3 commits April 1, 2026 23:35
…s/ProcessManager.Windows.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…s/ProcessManager.Windows.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…s/ProcessManager.Windows.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jkotas
Copy link
Copy Markdown
Member

jkotas commented Apr 2, 2026

Broken test project reference — System.IO.IsolatedStorage.Tests.csproj

@copilot Address this feedback

…cs in IsolatedStorage.Tests.csproj

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/cd6ef44b-8964-4040-91cc-d7a2bff92c64

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 2, 2026

Broken test project reference — System.IO.IsolatedStorage.Tests.csproj

@copilot Address this feedback

Fixed in 6b1ac1b. The test csproj was still referencing Helper.Win32.cs which was renamed to Helper.Windows.cs — updated the reference and link name accordingly.

Copilot AI requested a review from jkotas April 2, 2026 06:47
@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

🤖 Copilot Code Review — PR #126450

Note

This review was generated by Copilot.

Holistic Assessment

Motivation: Justified housekeeping — the *.Win32.cs vs *.Windows.cs split is a historical artifact from when Windows Store apps couldn't use the full Win32 API surface. Consolidating on *.Windows.cs removes a confusing naming inconsistency and aligns with the documented convention in cross-platform-guidelines.md.

Approach: The approach is correct and well-executed — simple git mv renames where no existing .Windows.cs file exists, and careful content merges (with code moved to the end of the target file) where one does. All .csproj/.projitems references are updated, and the documentation is updated to match.

Summary: ✅ LGTM. This is a purely mechanical rename/merge with no functional code changes. The merged content is identical to the original source. All review feedback from @jkotas (fields-first ordering, ItemGroup deduplication, struct indentation fixes) has been addressed. No new public API surface is introduced.


Detailed Findings

✅ File Renames — Correct and complete

All 11 *.Win32.cs files under src/libraries (excluding Common/ and ref/) have been handled:

  • 5 simple renames: FileSystemWatcher, Helper, SerialPort, HijriCalendar, TimeZoneInfo
  • 6 content merges: Process, ProcessManager, ProcessStartInfo, NamedPipeServerStream, SerialStream, Environment

No remaining *.Win32.cs platform-specific partial class files exist. The Win32.cs files in System.Security.AccessControl and System.Security.Principal.Windows are type-name files (class Win32), not platform-specific partials — correctly excluded from this rename.

✅ Content Merges — No code lost or modified

Verified the merged content for the 6 merge targets (Process.Windows.cs, ProcessManager.Windows.cs, ProcessStartInfo.Windows.cs, NamedPipeServerStream.Windows.cs, SerialStream.Windows.cs, Environment.Windows.cs). In each case, the code from the deleted *.Win32.cs file was appended to the end of the existing *.Windows.cs file with no functional modifications. Line counts confirm completeness (e.g., ProcessManager: 755 + 429 → 1166 with shared headers deduplicated; Environment: 409 + 387 → 783).

✅ Project File Updates — Consistent

  • All .csproj and .projitems references correctly updated from *.Win32.cs to *.Windows.cs (or removed where content was merged into an already-referenced file).
  • System.Diagnostics.Process.csproj: Duplicate windows ItemGroup merged correctly; Interop.ShellExecuteExW.cs moved into the existing windows-conditioned block.
  • System.IO.Ports.csproj: SerialStream.Win32.cs correctly removed (content merged into already-included SerialStream.Windows.cs); SerialPort.Win32.cs correctly renamed in-place.
  • System.IO.IsolatedStorage.Tests.csproj: Test project reference fixed (Helper.Win32.csHelper.Windows.cs).

✅ Review Feedback — All addressed

  • Fields moved to top of classes in Process.Windows.cs, ProcessManager.Windows.cs, and Environment.Windows.cs per @jkotas request.
  • MainWindowFinder struct indentation corrected.
  • using directives sorted (System.Threading placed correctly in ProcessManager.Windows.cs).
  • Blank line added before GetModules in ProcessManager.Windows.cs.

✅ Documentation — Updated

docs/coding-guidelines/cross-platform-guidelines.md updated to use *.Windows.cs in the naming example and clarify the suffix convention with concrete examples.

💡 Using Directive Order — Minor

In Environment.Windows.cs, using Internal.Win32; appears after using Microsoft.Win32.SafeHandles;. Alphabetically Internal sorts before Microsoft. This is extremely minor and the PR has already been approved — noting for completeness only. No action needed.

Generated by Code Review for issue #126450 ·

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's merge it now so we don't have to solve even more merge conflicts in the near future.

@jkotas thank you for improving this and providing the historical background!

@adamsitnik adamsitnik merged commit 34d4f17 into main Apr 2, 2026
154 of 156 checks passed
@adamsitnik adamsitnik deleted the copilot/rename-win32-to-windows-files branch April 2, 2026 18:16
@adamsitnik adamsitnik added this to the 11.0.0 milestone Apr 2, 2026
radekdoulik pushed a commit to radekdoulik/runtime that referenced this pull request Apr 9, 2026
…26450)

Renames all `*.Win32.cs` files under `src/libraries` to `*.Windows.cs`.
If a corresponding `*.Windows.cs` already exists, the content of the
`*.Win32.cs` file is merged into it.

`win32.cs` vs. `windows.cs` is a historic leftover from the times when
Windows Store apps were not able to use the full Win32 API surface. It
does not make sense anymore.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants