You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I write a code trying to deserialize with Parallel.ForEach but it ran into an exception that:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
at YamlDotNet.Serialization.ObjectFactories.DefaultObjectFactory.GetStateMethods(Type attributeType, Type valueType)
at YamlDotNet.Serialization.ObjectFactories.DefaultObjectFactory.ExecuteState(Type attributeType, Object value)
at YamlDotNet.Serialization.ObjectFactories.DefaultObjectFactory.ExecuteOnDeserializing(Object value)
at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
To Reproduce
This is a minimal Program.cs to reproduce this question:
using YamlDotNet.Serialization;using YamlDotNet.Serialization.NamingConventions;DeserializerBuilderbuilder=new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).IgnoreUnmatchedProperties();IDeserializerdeserializer= builder.Build();List<int>array=[1,2,3,4,5,6,7,8];conststringcontent="title: 123123123";
Parallel.ForEach(array,_ =>{Modelmodel= deserializer.Deserialize<Model>(content); Console.WriteLine(model.Title);});publicclassModel{publicstring?Title{get;set;}}
The text was updated successfully, but these errors were encountered:
Describe the bug
I write a code trying to deserialize with
Parallel.ForEach
but it ran into an exception that:To Reproduce
This is a minimal
Program.cs
to reproduce this question:The text was updated successfully, but these errors were encountered: