BryanWilhite / SonghayCore

core reusable, opinionated concerns for *all* 🧐 of my C# projects
http://songhayblog.azurewebsites.net/
MIT License
1 stars 0 forks source link

Trace verbosity can cause `OutOfMemoryException` #87

Closed BryanWilhite closed 3 years ago

BryanWilhite commented 4 years ago

yes, i have missed the obvious, kids 🙄 :

image

BryanWilhite commented 4 years ago

trace-writing the contents of an entire file surely is an anti-pattern 💡; this strongly motivates the use of conventions around associating a summary with a document

BryanWilhite commented 3 years ago

i finally see now that traceSource?.TraceError(ex) in a loop (or in a method called from a loop) is a leading anti-pattern because of the stack trace

at the very least traceSource?.TraceError(ex) should not include the stack trace by default; users of the API should opt in to the stack trace

BryanWilhite commented 3 years ago

another leading anti-pattern is around this call: writer.ToString() which immediately needs RAM; a stream-based pattern would not need so much RAM

IActivityExtensions needs stream-based alternatives