Skip to content

The type initializer for 'Mapster.TypeAdapter`2' threw an exception. #138

@mvareeth

Description

@mvareeth

Hi

I am using Mapster 3.0.4 with DotNet Core 1.0. I am getting following intermittent error in production where the application has many user bases. I doubt Mapster is not considering thread safety while converting the object model. Can you please help to solve this issue?

"System.TypeInitializationException: The type initializer for 'Mapster.TypeAdapter2' threw an exception. ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Enumerator.MoveNext()
at Mapster.SettingStore.Apply(SettingStore other)
at Mapster.TypeAdapterConfig.GetMergedSettings(TypeTuple tuple, MapType mapType)
at Mapster.TypeAdapterConfig.GetCompileArgument(TypeTuple tuple, MapType mapType, CompileContext context)
at Mapster.TypeAdapterConfig.CreateMapExpression(TypeTuple tuple, MapType mapType)
at Mapster.TypeAdapterConfig.b__55_0(TypeTuple tuple)
at Mapster.TypeAdapterConfig.AddToHash(Hashtable hash, TypeTuple key, Func2 func) at Mapster.TypeAdapterConfig.GetMapFunction(Type sourceType, Type destinationType) at Mapster.TypeAdapterConfig.GetMapFunction[TSource,TDestination]() at Mapster.TypeAdapter2..cctor()
--- End of inner exception stack trace ---
at Mapster.TypeAdapter.Adapt[TSource,TDestination](TSource source)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions