C# Deserialzation fails

I am trying to consume a stream using C#

Deserialzation of both key and value (string,string) fails with exception:

Message: The type initializer for 'PerTypeValues1' threw an exception. Trace: at System.SpanHelpers.IsReferenceOrContainsReferences[T]() at System.ReadOnlySpan1…ctor(Void* pointer, Int32 length)

Can anybody help to point us in the right direction??