To string in log (ARCH1006)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key dotnet.logging.to-string-in-log · Severity info · Category logging
Calling ToString() manually on log parameters incurs a conversion cost even when the log level is disabled. Pass the object directly.
Incorrect
Section titled “Incorrect”_logger.LogInformation("Order received {Order}", order.Id.ToString());Correct
Section titled “Correct”_logger.LogInformation("Order received {Order}", order.Id);Remove the ToString() call and pass the value as-is; let the logging infrastructure handle formatting.