Skip to content

Update RetrievalOfCpuCores to .NET 11 and System.Management 11.0.0 - #2411

Merged
vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/114937-csharp-retrieve-the-number-of-cpu-cores
Nov 15, 2026
Merged

vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/114937-csharp-retrieve-the-number-of-cpu-cores

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Retargets the RetrievalOfCpuCores sample and its tests to net11.0, replaces the System.Management 9.0 preview with the stable 11.0.0 release and moves MSTest to 4.5.3 with Test.Sdk 18.12.0 and coverlet 10.1.0. The WMI methods now dispose their ManagementObjectSearcher and read values with Convert.ToInt32, the SetupAPI device count is renamed GetLogicalProcessorsIncludingExcluded, a new GetExcludedProcessors subtracts the WMI logical count from it, Program.cs prints the new method and a ParallelOptions example, and the logical processor test now checks that ProcessorCount is at most the WMI count. The six Windows-only tests end in _Live so the Linux CI filter skips them.

Retarget both projects to net11.0, move System.Management off the 9.0 preview to 11.0.0, update MSTest to 4.5.3. Dispose ManagementObjectSearcher, read WMI values with Convert.ToInt32, rename the device-count method to GetLogicalProcessorsIncludingExcluded and add GetExcludedProcessors. Windows-only tests carry the Live suffix.
@vladimir-pecanac-main
vladimir-pecanac-main merged commit 8c5adaa into CodeMazeBlog:main Nov 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant