diff --git a/Chickensoft.Serialization.Tests/Chickensoft.Serialization.Tests.csproj b/Chickensoft.Serialization.Tests/Chickensoft.Serialization.Tests.csproj
index 40b1b1f..1a66349 100644
--- a/Chickensoft.Serialization.Tests/Chickensoft.Serialization.Tests.csproj
+++ b/Chickensoft.Serialization.Tests/Chickensoft.Serialization.Tests.csproj
@@ -42,7 +42,7 @@
-
-
+
+
diff --git a/Chickensoft.Serialization.Tests/test/fixtures/ChickenModels.cs b/Chickensoft.Serialization.Tests/test/fixtures/ChickenModels.cs
index 5819a6a..402ecf3 100644
--- a/Chickensoft.Serialization.Tests/test/fixtures/ChickenModels.cs
+++ b/Chickensoft.Serialization.Tests/test/fixtures/ChickenModels.cs
@@ -15,6 +15,9 @@ public partial record Person {
// Shouldn't be saved since no [Save] attribute is present.
public bool Valid { get; set; } = true;
+
+ // Shouldn't even be attempted to be saved since it cannot be read.
+ public string Strength { set { } }
}
public enum PetType {
diff --git a/Chickensoft.Serialization/Chickensoft.Serialization.csproj b/Chickensoft.Serialization/Chickensoft.Serialization.csproj
index 503241f..e50d34e 100644
--- a/Chickensoft.Serialization/Chickensoft.Serialization.csproj
+++ b/Chickensoft.Serialization/Chickensoft.Serialization.csproj
@@ -52,7 +52,7 @@
-
+
diff --git a/Chickensoft.Serialization/src/SerializableTypeConverter.cs b/Chickensoft.Serialization/src/SerializableTypeConverter.cs
index e8b6d5e..b0137ae 100644
--- a/Chickensoft.Serialization/src/SerializableTypeConverter.cs
+++ b/Chickensoft.Serialization/src/SerializableTypeConverter.cs
@@ -232,6 +232,11 @@ metadata is not IConcreteIntrospectiveTypeMetadata concreteMetadata
var properties = Graph.GetProperties(type);
foreach (var property in properties) {
+ if (property.Getter is not { } getter) {
+ // Property cannot be read, only set.
+ continue;
+ }
+
if (GetPropertyId(property) is not { } propertyId) {
// Only write properties marked with the [Save] attribute.
continue;
@@ -246,7 +251,7 @@ metadata is not IConcreteIntrospectiveTypeMetadata concreteMetadata
options
);
- var propertyValue = property.Getter(value);
+ var propertyValue = getter(value);
var valueType = propertyValue?.GetType();
var propertyType = property.GenericType.ClosedType;