During session save, use the profile's GUID rather than its Name (#19113)

This will prevent Terminal from erroneously selecting a hidden (deleted,
disabled or otherwise) profile of the same name during restoration and
subsequently using the wrong settings.

I am not certain why we used the name at all!

Closes #19105

(cherry picked from commit c4fbb58f69b0a5cc86c245505311d0a0b3cc1399)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgcbMe0
Service-Version: 1.23
This commit is contained in:
Dustin L. Howett 2025-07-09 15:42:23 -05:00 committed by Dustin L. Howett
parent 7d751a54bd
commit b6c7410a33

View File

@ -95,7 +95,7 @@ namespace winrt::TerminalApp::implementation
NewTerminalArgs args{};
const auto& controlSettings = _control.Settings();
args.Profile(controlSettings.ProfileName());
args.Profile(::Microsoft::Console::Utils::GuidToString(_profile.Guid()));
// If we know the user's working directory use it instead of the profile.
if (const auto dir = _control.WorkingDirectory(); !dir.empty())
{