Feature: Remove ThreadPool workaround and make scanner async - #3564
Feature: Remove ThreadPool workaround and make scanner async#3564BornToBeRoot wants to merge 3 commits into
Conversation
|
Tick the box to add this pull request to the merge queue (same as
|
There was a problem hiding this comment.
🟡 Changes recommended
Cancellation regressions, abandoned NetBIOS receive tasks, and the missing promised changelog entry need correction.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Removes the ThreadPool workaround and modernizes scanner operations with asynchronous network APIs.
Changes:
- Removes ThreadPool configuration from settings, UI, localization, and documentation.
- Converts host, port, ping, DNS, and NetBIOS scanning paths to async.
- Updates scanner defaults and introduces a shared TCP port probe.
File summaries
| File | Description |
|---|---|
Website/docs/settings/general.md |
Removes ThreadPool documentation. |
Website/docs/application/port-scanner.md |
Updates concurrency documentation. |
Website/docs/application/ip-scanner.md |
Updates ports and concurrency defaults. |
Source/NETworkManager/Views/SettingsGeneralView.xaml |
Removes ThreadPool setting UI. |
Source/NETworkManager/Views/PortScannerSettingsView.xaml |
Removes obsolete ThreadPool notice. |
Source/NETworkManager/Views/IPScannerSettingsView.xaml |
Removes obsolete ThreadPool notice. |
Source/NETworkManager/ViewModels/SettingsGeneralViewModel.cs |
Removes ThreadPool setting binding. |
Source/NETworkManager/App.xaml.cs |
Removes ThreadPool startup configuration. |
Source/NETworkManager.Settings/SettingsInfo.cs |
Removes persisted ThreadPool setting. |
Source/NETworkManager.Settings/GlobalStaticConfiguration.cs |
Updates scanner defaults. |
Source/NETworkManager.Models/Network/PortScanner.cs |
Makes port scanning asynchronous. |
Source/NETworkManager.Models/Network/PortProbe.cs |
Adds shared asynchronous TCP probing. |
Source/NETworkManager.Models/Network/NetBIOSResolver.cs |
Makes receive timeout asynchronous. |
Source/NETworkManager.Models/Network/IPScanner.cs |
Converts scanner operations to async. |
Source/NETworkManager.Models/Network/HostRangeHelper.cs |
Makes hostname resolution asynchronous. |
Source/NETworkManager.Localization/Resources/Strings.resx |
Removes obsolete localized strings. |
Source/NETworkManager.Localization/Resources/Strings.Designer.cs |
Removes generated resource accessors. |
Review details
Files not reviewed (1)
- Source/NETworkManager.Localization/Resources/Strings.Designer.cs: Generated file
Suppressed comments (1)
Source/NETworkManager.Models/Network/HostRangeHelper.cs:163
- The hostname-with-subnet branch also stops honoring cancellation while DNS is pending. Since this helper may perform both A and AAAA queries, Stop can remain stuck in preparation until all lookup timeout/retry work completes. Make the await token-aware.
var dnsResultWithSubnet = await DNSClientHelper.ResolveAorAaaaAsync(hostAndSubnet[0], true)
.ConfigureAwait(false);
- Files reviewed: 17/18 changed files
- Comments generated: 5
- Review effort level: Balanced
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| var dnsResult = await DNSClient.GetInstance().ResolvePtrAsync(host.ipAddress) | ||
| .ConfigureAwait(false); |
| var dnsResult = await DNSClient.GetInstance().ResolvePtrAsync(host.ipAddress) | ||
| .ConfigureAwait(false); |
| var dnsResult = await DNSClientHelper.ResolveAorAaaaAsync(host, dnsResolveHostnamePreferIPv4) | ||
| .ConfigureAwait(false); |
| var receiveTask = udpClient.ReceiveAsync(); | ||
| var timeoutTask = Task.Delay(timeout, cancellationToken); | ||
|
|
||
| if (!receiveTask.Wait(timeout, cancellationToken)) | ||
| var completedTask = await Task.WhenAny(receiveTask, timeoutTask).ConfigureAwait(false); | ||
|
|
||
| if (completedTask == timeoutTask) | ||
| return new NetBIOSInfo(ipAddress); |
| description: "Configure which applications appear in the NETworkManager sidebar and adjust general application behavior." | ||
| keywords: [NETworkManager, general settings, sidebar configuration, application settings] |
There was a problem hiding this comment.
🟡 Changes recommended
Existing settings omit the new default ports, and concurrent cancellation can incorrectly fault TCP probes.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Files not reviewed (1)
- Source/NETworkManager.Localization/Resources/Strings.Designer.cs: Generated file
Suppressed comments (2)
Source/NETworkManager.Models/Network/PortProbe.cs:47
- The general exception filter makes normal connect failures escape whenever user cancellation happens concurrently. For example, a
SocketExceptionfrom a refused connection is no longer mapped toClosedif the token was canceled just before the catch executes; it faults the fire-and-forget scan, and the scanners only reportOperationCanceledExceptionas cancellation. Re-throw cancellation exceptions explicitly, but continue classifying every non-cancellation connect failure asClosed.
catch (Exception) when (!cancellationToken.IsCancellationRequested)
{
// Connection refused, host unreachable, etc.
return PortState.Closed;
Source/NETworkManager.Settings/SettingsManager.cs:773
- Existing installations that still have the old default port list never receive the newly defaulted ports. Changing
GlobalStaticConfigurationonly affects newly created settings; this upgrade migrates the old concurrency defaults but omits the analogousIPScanner_PortScanPortsmigration, so upgraded users continue scanning without ports 135 and 9100. Migrate the value only when it exactly matches the old default, preserving customized lists.
// Add new Port Scanner port profiles
- Files reviewed: 23/24 changed files
- Comments generated: 0 new
- Review effort level: Balanced
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Changes proposed in this pull request
To-Do
Contributing
By submitting this pull request, I confirm the following: