-
Notifications
You must be signed in to change notification settings - Fork 380
Debugging
chaowlert edited this page Apr 13, 2019
·
13 revisions
PM> Install-Package ExpressionDebugger
This plugin allow you to perform step-into debugging!
Then add following code on start up (or anywhere before mapping is compiled)
var opt = new ExpressionCompilationOptions { IsRelease = !Debugger.IsAttached };
TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileWithDebugInfo(opt);
Now on your mapping code (only in DEBUG
mode).
var dto = poco.Adapt<SimplePoco, SimpleDto>(); //<--- you can step-into this function!!
private
, protected
and internal
don't allow in debug mode.
We can also see how Mapster generate 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 { IsRelease = !Debugger.IsAttached, EmitFile = true };
TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileWithDebugInfo(opt);
...
var dto = poco.Adapt<SimplePoco, SimpleDto>(); //<-- you can step-into this function!!
- Configuration
- Config inheritance
- Config instance
- Config location
- Config validation & compilation
- Config for nested mapping
- Custom member matching logic
- Constructor mapping
- Before & after mapping
- Setting values
- Shallow & merge mapping
- Recursive & object references
- Custom conversion logic
- Inheritance