c# - How to Find Out Which Record Automapper Errors Out On? -


i using automapper. code looks this:

var processedrecords = await queriedrecords.project(x =>                                   mapper.map<bsondocument, recordviewmodel>(x)).tolistasync(); 

my problem cannot put system.diagnostics.debug.writeline() inside map definition. there way know record automapper errors out on? way have been doing putting break point in , clicking continue, working db millions of records, that's not practical.

the exception "object reference not set instance of object." assume means object doesn't have property trying map, it's irrelevant q. more interested in theory here.

well, can put debug.writeline() in lambda here. make block instead of expression:

var processedrecords = await queriedrecords.project(x =>     {         system.diagnostics.debug.writeline(x);         return mapper.map<bsondocument, recordviewmodel>(x);     }).tolistasync(); 

you can put try/catch around mapper.map<,>() call if want now.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -