AsyncWrapper Does Not Work With AutoFlush

Skip to first unread message

Patrick Skelton

Jun 20, 2017, 7:28:22 AM6/20/17
to NLog-Users
I have an NLog setup that attempts to send an email when an error occurs.  The error message is fairly long.  It is built by reading the whole contents of an NLog MemoryTarget and writing this into the email.  So, if one of these error messages gets sent when you are using the UI of the application, there is a noticeable delay while the email is sent.

Wrapping the MailTarget in an AsyncWrapper fixes this problem, but it leaves the problem that the email gets sent with some lines missing.  If I wrap the MailTarget in an AutoFlushWrapper, I get all the lines but I am back to the problem of having the UI freeze while the email is sent.

If I try to wrap the MailTarget in both an AutoFlushWrapper and an AsyncWrapper, the former appears to take precedence and the latter seems to be ignored or at least it doesn't appear to work, because I go back to the UI freezing.

Does anyone know if there is a reported problem with these two working together?  And does anyone know of a way I might fix this?

Reply all
Reply to author
0 new messages