Skip to content

Commit 59e1608

Browse files
authored
Use Activator.CreateInstance in CosmosGrainStorage when record does not exist (#9277)
Use Activator.CreateInstance in CosmosGrainStorage to support types with primary constructors
1 parent 4777dae commit 59e1608

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Azure/Orleans.Persistence.Cosmos/CosmosGrainStorage.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public async Task ReadStateAsync<T>(string grainType, GrainId grainId, IGrainSta
7575
}
7676
else
7777
{
78-
grainState.State = ActivatorUtilities.CreateInstance<T>(_serviceProvider);
78+
grainState.State = Activator.CreateInstance<T>();
7979
grainState.RecordExists = false;
8080
}
8181

@@ -86,7 +86,7 @@ public async Task ReadStateAsync<T>(string grainType, GrainId grainId, IGrainSta
8686
if (dce.StatusCode == HttpStatusCode.NotFound)
8787
{
8888
// State is new, just activate a default and return
89-
grainState.State = ActivatorUtilities.CreateInstance<T>(_serviceProvider);
89+
grainState.State = Activator.CreateInstance<T>();
9090
grainState.RecordExists = false;
9191
return;
9292
}

0 commit comments

Comments
 (0)