Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions Source/NETworkManager/ViewModels/IPScannerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ private async Task DetectIPRange()
{
IsSubnetDetectionRunning = true;

var localIP = await NetworkInterface.DetectLocalIPAddressBasedOnRoutingAsync(IPAddress.Parse("1.1.1.1"));
var localIP = await NetworkInterface.DetectLocalIPAddressBasedOnRoutingAsync(IPAddress.Parse(GlobalStaticConfiguration.Dashboard_PublicIPv4Address));

// Could not detect local ip address
if (localIP != null)
Expand Down Expand Up @@ -716,7 +716,9 @@ public void OnClose()
private void HostScanned(object sender, IPScannerHostScannedArgs e)
{
Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
new Action(delegate { Results.Add(e.Args); }));
new Action(delegate {
Results.Add(e.Args);
}));
}

/// <summary>
Expand All @@ -736,14 +738,19 @@ private void ProgressChanged(object sender, ProgressChangedArgs e)
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ScanComplete(object sender, EventArgs e)
{
if (Results.Count == 0)
// Run in UI thread with lower priority than HostScanned event
// to ensure all results are added first #3285
Application.Current.Dispatcher.Invoke(() =>
{
StatusMessage = Strings.NoReachableHostsFound;
IsStatusMessageDisplayed = true;
}
if (Results.Count == 0)
{
StatusMessage = Strings.NoReachableHostsFound;
IsStatusMessageDisplayed = true;
}

IsCanceling = false;
IsRunning = false;
IsCanceling = false;
IsRunning = false;
}, DispatcherPriority.Background);
}

/// <summary>
Expand Down
17 changes: 11 additions & 6 deletions Source/NETworkManager/ViewModels/PortScannerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -565,14 +565,19 @@ private void ProgressChanged(object sender, ProgressChangedArgs e)

private void ScanComplete(object sender, EventArgs e)
{
if (Results.Count == 0)
// Run in UI thread with lower priority than PortScanned event
// to ensure all results are added first #3285
Application.Current.Dispatcher.Invoke(() =>
{
StatusMessage = Strings.NoOpenPortsFound;
IsStatusMessageDisplayed = true;
}
if (Results.Count == 0)
{
StatusMessage = Strings.NoOpenPortsFound;
IsStatusMessageDisplayed = true;
}

IsCanceling = false;
IsRunning = false;
IsCanceling = false;
IsRunning = false;
}, DispatcherPriority.Background);
}

private void UserHasCanceled(object sender, EventArgs e)
Expand Down
8 changes: 8 additions & 0 deletions Website/docs/changelog/next-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ Release date: **xx.xx.2025**

## Bug Fixes

**IP Scanner**

- Fix race condition when scan is complete but not all results have been processed yet, causing a wrong error message to be displayed. [#3287](https://github.com/BornToBeRoot/NETworkManager/pull/3287)

**Port Scanner**

- Fix race condition when scan is complete but not all results have been processed yet, causing a wrong error message to be displayed. [#3287](https://github.com/BornToBeRoot/NETworkManager/pull/3287)

**PowerShell**

- Resolve the actual path to `pwsh.exe` under `C:\Program Files\WindowsApps\` instead of relying on the stub located at `%LocalAppData%\Microsoft\WindowsApps\`. The stub simply redirects to the real executable, and settings such as themes are applied only to the real binary via the registry. [#3246](https://github.com/BornToBeRoot/NETworkManager/pull/3246)
Expand Down