Skip to content

Commit 0b9d6d6

Browse files
ChiragAgg5kCopilot
andauthored
Update templates/dotnet/Package/Extensions/Extensions.cs.twig
Co-authored-by: Copilot <[email protected]>
1 parent 951a27a commit 0b9d6d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates/dotnet/Package/Extensions/Extensions.cs.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace {{ spec.title | caseUcfirst }}.Extensions
1717
{
1818
return value switch
1919
{
20-
JsonElement jsonElement => jsonElement.Deserialize<List<T>>()!,
20+
JsonElement jsonElement => jsonElement.Deserialize<List<T>>() ?? throw new InvalidCastException($"Cannot deserialize {jsonElement} to List<{typeof(T)}>."),
2121
object[] objArray => objArray.Cast<T>().ToList(),
2222
List<T> list => list,
2323
IEnumerable<T> enumerable => enumerable.ToList(),

0 commit comments

Comments
 (0)