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
Hi, the issues we are hitting with using mapster is that error messages are not very descriptive and it's hard to understand which map is missing or which one is set up incorrectly.
Is there any way to enable logging which can produce human-readable or more detailed output when mapster has an error in mapping. Mapster errors are very generic and don't have any information about what exact type mapping is missing or throwing error. Having a detailed log output like this: var mappingErrors = TypeAdapterConfig.GlobalSettings.Compile(); would be very helpful.
Or maybe let us to pass some simple logger interface implementation which will be used internally to write detailed information about what's exactly goes wrong:
IMapsterLogger logger = new MyMapsterLogger();
TypeAdapterConfig.GlobalSettings.Compile(logger);
Another option is to have mapster specific TraceSource (which is platform dependent but very performant way to log info on Windows) where we can hook and see some extra details about which types are being checked with which settings, in compile phase, and whether they failed or not.
Errors like these are is the same as "Well, some error happened"
System.TypeInitializationException
The type initializer for 'Mapster.TypeAdapter`2' threw an exception.
at lambda_method(Closure , AnnotationCommandData )
at Utils.Mapping.DTOMap.Map[TSource,TResult](TSource inputSource) in C:\Projects\xxx\DTOMap.cs:line 42
at UnitTests.Mappings.DTOMapTests.CheckAllMaps() in C:\Projects\xxx\Mappings\DTOMapTests.cs:line 160
System.InvalidOperationException
Instances of abstract classes cannot be created.
at System.Runtime.CompilerServices.RuntimeHelpers._CompileMethod(IRuntimeMethodInfo method)
at System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType, Object target)
at System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator)
at Mapster.TypeAdapterConfig.CreateMapFunction(TypeTuple tuple)
at Mapster.TypeAdapterConfig.AddToHash(Hashtable hash, TypeTuple key, Func`2 func)
at Mapster.TypeAdapterConfig.GetMapFunction[TSource,TDestination]()
at Mapster.TypeAdapter`2..cctor()
The text was updated successfully, but these errors were encountered:
centur
changed the title
Question: Is there any way to debug mappings using logging or something
Question: Is there any way to debug mappings using logging or TraceSource
Aug 4, 2016
Hi, the issues we are hitting with using mapster is that error messages are not very descriptive and it's hard to understand which map is missing or which one is set up incorrectly.
Is there any way to enable logging which can produce human-readable or more detailed output when mapster has an error in mapping. Mapster errors are very generic and don't have any information about what exact type mapping is missing or throwing error. Having a detailed log output like this:
var mappingErrors = TypeAdapterConfig.GlobalSettings.Compile();
would be very helpful.Or maybe let us to pass some simple logger interface implementation which will be used internally to write detailed information about what's exactly goes wrong:
Another option is to have mapster specific TraceSource (which is platform dependent but very performant way to log info on Windows) where we can hook and see some extra details about which types are being checked with which settings, in compile phase, and whether they failed or not.
Errors like these are is the same as "Well, some error happened"
The text was updated successfully, but these errors were encountered: