Compare commits

..

3 Commits

Author SHA1 Message Date
Muyuan Li (from Dev Box)
f9679b937d Address review: handle NavigationFailed gracefully without rethrowing
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-14 16:20:42 +08:00
copilot-swe-agent[bot]
36300d3c75 Fix NullReferenceException in Frame_NavigationFailed when e.Exception is null
Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/af982aa1-504b-47f1-9ec0-93b29602b2af

Co-authored-by: MuyuanMS <116717757+MuyuanMS@users.noreply.github.com>
2026-04-29 08:49:32 +00:00
copilot-swe-agent[bot]
1cde68ae04 Initial plan 2026-04-29 08:48:31 +00:00
4 changed files with 16 additions and 4 deletions

View File

@@ -31,7 +31,7 @@ public static class TerminalHelper
}
else if (openNewTab)
{
argsPrefix = "nt";
argsPrefix = "--window 0 nt";
}
return $"{argsPrefix} --profile \"{profileName}\"";

View File

@@ -18,7 +18,7 @@ namespace Microsoft.Plugin.WindowsTerminal.UnitTests
[DataTestMethod]
[DataRow("Windows PowerShell", true, true, "--window _quake --profile \"Windows PowerShell\"")]
[DataRow("Windows PowerShell", false, true, "--window _quake --profile \"Windows PowerShell\"")]
[DataRow("Windows PowerShell", true, false, "nt --profile \"Windows PowerShell\"")]
[DataRow("Windows PowerShell", true, false, "--window 0 nt --profile \"Windows PowerShell\"")]
[DataRow("Windows PowerShell", false, false, " --profile \"Windows PowerShell\"")]
public void ArgumentsTest(string profile, bool openNewTab, bool openQuake, string expectedArguments)
{

View File

@@ -28,7 +28,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsTerminal.Helpers
}
else if (openNewTab)
{
argsPrefix = "nt";
argsPrefix = "--window 0 nt";
}
return $"{argsPrefix} --profile \"{profileName}\"";

View File

@@ -9,6 +9,7 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
@@ -135,7 +136,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw e.Exception;
var sourcePage = e.SourcePageType?.FullName ?? "<unknown>";
if (e.Exception is null)
{
Logger.LogWarning($"Navigation to '{sourcePage}' failed without an exception.");
}
else
{
Logger.LogError($"Navigation to '{sourcePage}' failed.", e.Exception);
}
e.Handled = true;
}
private void Frame_Navigated(object sender, NavigationEventArgs e)