Following the advice from https://nblumhardt.com/2016/02/serilog-tip-dont-serialize-arbitrary-objects/ , it's quite a common pattern to use anonymous classes as a property to enrich a log event. In those case, it's important to remember to add the @destructuring operator in the message template, or else, the ToString() behavior will be used.
It would be good to detect cases where the user has passed a property of an anonymous type, but forgot to add the @ operator. The code fix would be to add the missing operator in the template.
Following the advice from https://nblumhardt.com/2016/02/serilog-tip-dont-serialize-arbitrary-objects/ , it's quite a common pattern to use anonymous classes as a property to enrich a log event. In those case, it's important to remember to add the
@
destructuring operator in the message template, or else, theToString()
behavior will be used.It would be good to detect cases where the user has passed a property of an anonymous type, but forgot to add the
@
operator. The code fix would be to add the missing operator in the template.