/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/AppStateModel.cs
35 строк
1 KB
Mike Griese
CmdPal: fix initializing the Run history in AOT builds (#48463)
18 июн 2026, 20:55
Не верифицирован
18 июн 2026, 20:55
fb0f429
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; namespace Microsoft.CmdPal.UI.ViewModels; public record AppStateModel { /////////////////////////////////////////////////////////////////////////// // STATE HERE // Make sure that any new types you add are added to JsonSerializationContext! private RecentCommandsManager? _recentCommands = new(); public RecentCommandsManager RecentCommands { get => _recentCommands ?? new(); init => _recentCommands = value; } // HERE BE DRAGONS: Using an ImmutableList<T> for a setting may explode in // AOT builds. Make sure to test IN AOT setting this setting to null, [], // and and array with values. private ImmutableList<string>? _runHistory = ImmutableList<string>.Empty; public ImmutableList<string> RunHistory { get => _runHistory ?? ImmutableList<string>.Empty; init => _runHistory = value; } // END SETTINGS /////////////////////////////////////////////////////////////////////////// }