From 59e1608f0b3b1c8be742775c5813efd6b3f91217 Mon Sep 17 00:00:00 2001 From: Egil Hansen Date: Sat, 4 Jan 2025 20:00:12 +0000 Subject: [PATCH] Use Activator.CreateInstance in CosmosGrainStorage when record does not exist (#9277) Use Activator.CreateInstance in CosmosGrainStorage to support types with primary constructors --- src/Azure/Orleans.Persistence.Cosmos/CosmosGrainStorage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Azure/Orleans.Persistence.Cosmos/CosmosGrainStorage.cs b/src/Azure/Orleans.Persistence.Cosmos/CosmosGrainStorage.cs index 99cdeba5c4..6a105c1f52 100644 --- a/src/Azure/Orleans.Persistence.Cosmos/CosmosGrainStorage.cs +++ b/src/Azure/Orleans.Persistence.Cosmos/CosmosGrainStorage.cs @@ -75,7 +75,7 @@ public async Task ReadStateAsync(string grainType, GrainId grainId, IGrainSta } else { - grainState.State = ActivatorUtilities.CreateInstance(_serviceProvider); + grainState.State = Activator.CreateInstance(); grainState.RecordExists = false; } @@ -86,7 +86,7 @@ public async Task ReadStateAsync(string grainType, GrainId grainId, IGrainSta if (dce.StatusCode == HttpStatusCode.NotFound) { // State is new, just activate a default and return - grainState.State = ActivatorUtilities.CreateInstance(_serviceProvider); + grainState.State = Activator.CreateInstance(); grainState.RecordExists = false; return; }