Mapster
Mapster copied to clipboard
Issue creating config with Include when testing
We have developed a service using Mapster to map our model and more particularly the Include method to configure the mapping.
public TypeAdapterSetter<TSource, TDestination> Include<TDerivedSource, TDerivedDestination>()
where TDerivedSource : class, TSource
where TDerivedDestination : class, TDestination
{
return this.Include<TypeAdapterSetter<TSource, TDestination>>(typeof (TDerivedSource), typeof (TDerivedDestination));
}
The issue happens when we run the tests (Integration tests). If the test is run unitary, it works. But when all the tests are run, we have the following exception on some tests.
System.ArgumentOutOfRangeException
capacity was less than the current size. (Parameter 'value')
at System.Collections.Generic.List1.set_Capacity(Int32 value) at System.Collections.Generic.List
1.Grow(Int32 capacity)
at System.Collections.Generic.List1.AddWithResize(T item) at Mapster.TypeAdapterSetterExtensions.Include[TSetter](TSetter setter, Type sourceType, Type destType) at Mapster.TypeAdapterSetter
2.IncludeTDerivedSource,TDerivedDestination
The code is:
TypeAdapterConfig<ConfigurationModel, Configuration>
.NewConfig()
.Include<AValueModel, AValue>()
.Include<BValueModel, BValue>()
.Include<CValueModel,DValue>();
Any idea what could be the issue ?
Thank you ?
Im getting the same error. Did you figure out how to fix it?
Got the same issue here...