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
public class Source
{
public Dictionary<string, string> Dict { get; set; } = new Dictionary<string, string> {{"a", "b"}};
}
public class Destination
{
public IDictionary<string, string> Dict { get; set; }
}
public static void Main(string[] args)
{
var a = new Source().Adapt<Destination>();
}
`
Then the exception is:
Unhandled exception. System.TypeInitializationException: The type initializer for 'Mapster.TypeAdapter2' threw an exception. ---> Mapster.CompileException: Error while compiling source=System.Collections.Generic.Dictionary2[System.String,System.String]
destination=System.Collections.Generic.IDictionary2[System.String,System.String] type=Map ---> System.TypeLoadException: Signature of the body and declaration in a method implementation do not match. Type: 'GeneratedType_1'. Assembly: 'Mapster.Dynamic, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock() at System.Reflection.Emit.TypeBuilder.CreateTypeInfo() at Mapster.Utils.DynamicTypeGenerator.CreateTypeForInterface(Type interfaceType) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory) at Mapster.Utils.DynamicTypeGenerator.GetTypeForInterface(Type interfaceType) at Mapster.Adapters.BaseAdapter.CreateInstantiationExpression(Expression source, Expression destination, CompileArgument arg) at Mapster.Adapters.ClassAdapter.CreateInstantiationExpression(Expression source, Expression destination, CompileArgument arg) at Mapster.Adapters.BaseAdapter.CreateBlockExpressionBody(Expression source, Expression destination, CompileArgument arg) at Mapster.Adapters.BaseAdapter.CreateExpressionBody(Expression source, Expression destination, CompileArgument arg) at Mapster.Adapters.BaseAdapter.CreateAdaptFunc(CompileArgument arg) at Mapster.TypeAdapterConfig.CreateMapExpression(CompileArgument arg) --- End of inner exception stack trace --- at Mapster.TypeAdapterConfig.CreateMapExpression(CompileArgument arg) at Mapster.TypeAdapterConfig.CreateMapExpression(TypeTuple tuple, MapType mapType) at Mapster.TypeAdapterConfig.<GetMapFunction>b__59_0(TypeTuple tuple) at Mapster.TypeAdapterConfig.AddToHash[T](Dictionary2 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 lambda_method(Closure , Object )
at Mapster.TypeAdapter.Adapt[TDestination](Object source, TypeAdapterConfig config)
at Mapster.TypeAdapter.Adapt[TDestination](Object source)
The text was updated successfully, but these errors were encountered:
`
`
Then the exception is:
Unhandled exception. System.TypeInitializationException: The type initializer for 'Mapster.TypeAdapter
2' threw an exception. ---> Mapster.CompileException: Error while compiling source=System.Collections.Generic.Dictionary
2[System.String,System.String]destination=System.Collections.Generic.IDictionary
2[System.String,System.String] type=Map ---> System.TypeLoadException: Signature of the body and declaration in a method implementation do not match. Type: 'GeneratedType_1'. Assembly: 'Mapster.Dynamic, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock() at System.Reflection.Emit.TypeBuilder.CreateTypeInfo() at Mapster.Utils.DynamicTypeGenerator.CreateTypeForInterface(Type interfaceType) at System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func2 valueFactory) at Mapster.Utils.DynamicTypeGenerator.GetTypeForInterface(Type interfaceType) at Mapster.Adapters.BaseAdapter.CreateInstantiationExpression(Expression source, Expression destination, CompileArgument arg) at Mapster.Adapters.ClassAdapter.CreateInstantiationExpression(Expression source, Expression destination, CompileArgument arg) at Mapster.Adapters.BaseAdapter.CreateBlockExpressionBody(Expression source, Expression destination, CompileArgument arg) at Mapster.Adapters.BaseAdapter.CreateExpressionBody(Expression source, Expression destination, CompileArgument arg) at Mapster.Adapters.BaseAdapter.CreateAdaptFunc(CompileArgument arg) at Mapster.TypeAdapterConfig.CreateMapExpression(CompileArgument arg) --- End of inner exception stack trace --- at Mapster.TypeAdapterConfig.CreateMapExpression(CompileArgument arg) at Mapster.TypeAdapterConfig.CreateMapExpression(TypeTuple tuple, MapType mapType) at Mapster.TypeAdapterConfig.<GetMapFunction>b__59_0(TypeTuple tuple) at Mapster.TypeAdapterConfig.AddToHash[T](Dictionary
2 hash, TypeTuple key, Func2 func) at Mapster.TypeAdapterConfig.GetMapFunction(Type sourceType, Type destinationType) at Mapster.TypeAdapterConfig.GetMapFunction[TSource,TDestination]() at Mapster.TypeAdapter
2..cctor()--- End of inner exception stack trace ---
at lambda_method(Closure , Object )
at Mapster.TypeAdapter.Adapt[TDestination](Object source, TypeAdapterConfig config)
at Mapster.TypeAdapter.Adapt[TDestination](Object source)
The text was updated successfully, but these errors were encountered: