Validate input string passed to LogValuesFormatter (#43238)
authorEugene Shcherbo <eugene.shcherbo@gmail.com>
Wed, 14 Oct 2020 15:26:04 +0000 (18:26 +0300)
committerGitHub <noreply@github.com>
Wed, 14 Oct 2020 15:26:04 +0000 (08:26 -0700)
commit2ca0b935aba3933bf0f22c30dbd3f86c34057a8d
treefe509eee290cb8052aeef9d8d6ab7aeaf6cd2cca
parent7ca6d85188e3352935d33b2202f2de8d253cc419
Validate input string passed to LogValuesFormatter (#43238)

Add validation of a format string passed to LogValuesFormatter
to throw `ArgumentNullException` if the string is `null`
so that all the methods of the `LogMessage.Define` group
depending on that class doesn't throw `NullReferenceException`
when configuring a logger.

Fix #36565
src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LogValuesFormatter.cs
src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerMessageTest.cs