PM> Install-Package ExpressionDebugger
This plugin allows you to perform step-into debugging using Roslyn!
Then add following code on start up (or anywhere before mapping is compiled)
TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileWithDebugInfo();
Now in your mapping code (only in DEBUG
mode).
var dto = poco.Adapt<SimplePoco, SimpleDto>(); //<--- you can step-into this function!!Using internal classes or members
private
, protected
and internal
aren't allowed in debug mode.
We can also see how Mapster generates mapping logic with ToScript
method.
var script = poco.BuildAdapter()
.CreateMapExpression<SimpleDto>()
.ToScript();
To step-into debugging, you might need to emit file
var opt = new ExpressionCompilationOptions { EmitFile = true }; TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileWithDebugInfo(opt); ... var dto = poco.Adapt<SimplePoco, SimpleDto>(); //<-- you can step-into this function!!Do not worry about performance
In RELEASE
mode, Roslyn compiler is actually faster than default dynamic compilation by 2x. Here is the result:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4