CmdPal: Fix settings deserialization ignoring defaults #46681
Azure Pipelines / PowerToys CI
failed
Mar 31, 2026 in 46m 41s
Build #PowerToys CI_2603.31023 failed
Annotations
azure-pipelines / PowerToys CI
src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs#L57
src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs(57,0): Error test failed: Constructor_LoadsSettings_ViaPersistenceService (81ms): Initialization method Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.Setup threw exception. System.InvalidOperationException: Each parameter in the deserialization constructor on type 'Microsoft.CmdPal.UI.ViewModels.SettingsModel' must bind to an object property or field on deserialization. Each parameter name must match with a property or field on the object. Fields are only considered when 'JsonSerializerOptions.IncludeFields' is enabled. The match can be case-insensitive..
Stack Trace:
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(Type parentType)
at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.CreateMinimalSettingsModel() in C:\a\_work\1\s\src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs:line 57
at Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.Setup() in C:\a\_work\1\s\src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs:line 43
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
azure-pipelines / PowerToys CI
src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs#L57
src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs(57,0): Error test failed: Settings_ReturnsLoadedModel (1ms): Initialization method Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.Setup threw exception. System.InvalidOperationException: Each parameter in the deserialization constructor on type 'Microsoft.CmdPal.UI.ViewModels.SettingsModel' must bind to an object property or field on deserialization. Each parameter name must match with a property or field on the object. Fields are only considered when 'JsonSerializerOptions.IncludeFields' is enabled. The match can be case-insensitive..
Stack Trace:
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(Type parentType)
at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.CreateMinimalSettingsModel() in C:\a\_work\1\s\src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs:line 57
at Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.Setup() in C:\a\_work\1\s\src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs:line 43
at InvokeStub_SettingsServiceTests.Setup(Object, Object, IntPtr*)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
azure-pipelines / PowerToys CI
src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs#L57
src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs(57,0): Error test failed: Save_DelegatesToPersistenceService (0ms): Initialization method Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.Setup threw exception. System.InvalidOperationException: Each parameter in the deserialization constructor on type 'Microsoft.CmdPal.UI.ViewModels.SettingsModel' must bind to an object property or field on deserialization. Each parameter name must match with a property or field on the object. Fields are only considered when 'JsonSerializerOptions.IncludeFields' is enabled. The match can be case-insensitive..
Stack Trace:
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(Type parentType)
at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.CreateMinimalSettingsModel() in C:\a\_work\1\s\src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs:line 57
at Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.Setup() in C:\a\_work\1\s\src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs:line 43
at InvokeStub_SettingsServiceTests.Setup(Object, Object, IntPtr*)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
azure-pipelines / PowerToys CI
src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs#L57
src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs(57,0): Error test failed: Save_WithHotReloadTrue_RaisesSettingsChangedEvent (0ms): Initialization method Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.Setup threw exception. System.InvalidOperationException: Each parameter in the deserialization constructor on type 'Microsoft.CmdPal.UI.ViewModels.SettingsModel' must bind to an object property or field on deserialization. Each parameter name must match with a property or field on the object. Fields are only considered when 'JsonSerializerOptions.IncludeFields' is enabled. The match can be case-insensitive..
Stack Trace:
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(Type parentType)
at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.CreateMinimalSettingsModel() in C:\a\_work\1\s\src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs:line 57
at Microsoft.CmdPal.UI.ViewModels.UnitTests.SettingsServiceTests.Setup() in C:\a\_work\1\s\src\modules\cmdpal\Tests\Microsoft.CmdPal.UI.ViewModels.UnitTests\SettingsServiceTests.cs:line 43
at InvokeStub_SettingsServiceTests.Setup(Object, Object, IntPtr*)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Loading