← All recipes
Moderne licensed

Cast RedisValue to string for JsonSerializer.Deserialize

Recipe IDOpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.CastRedisValueForJsonDeserializeArtifactOpenRewrite.Recipes.CSharp.Migration.Dotnet

JsonSerializer.Deserialize<T>(RedisValue) is an ambiguous call (CS0121) because StackExchange.Redis RedisValue implicitly converts to both string and ReadOnlySpan<byte>. Add an explicit (string) cast to disambiguate.

Single recipecsharpdotnetredisProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.CastRedisValueForJsonDeserialize

If the recipe isn’t available locally, install it with:

mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet