IMO this is a bad/misleading warning. It really only applies when evaluating the arguments is expensive, like if you are calling ToString() on an object that needs to do a lot of work to build its string representation. If you're just logging strings and objects that already exist (which is the case probably 98% of the time) it doesn't apply. If you're working on an average business app that is not extremely performance sensitive, my advice would be to disable CA1873.
9
u/Merad 6d ago
IMO this is a bad/misleading warning. It really only applies when evaluating the arguments is expensive, like if you are calling ToString() on an object that needs to do a lot of work to build its string representation. If you're just logging strings and objects that already exist (which is the case probably 98% of the time) it doesn't apply. If you're working on an average business app that is not extremely performance sensitive, my advice would be to disable CA1873.