-
Notifications
You must be signed in to change notification settings - Fork 245
LoggerMessage.LogValues<T> throws execption when calling [0] #410
Comments
Why are you using |
I only added a short example do reproduce the problem. |
@kichalla |
As @BrennanConroy mentioned, if you are not going to pass in named parmaters, do not use |
@kichalla This is our code in security FYI Sent from my HTC ----- Reply message ----- As @BrennanConroyhttps://github.com/BrennanConroy mentioned, if you are not going to pass in named parmaters, do not use Definehttps://github.com/aspnet/Security/blob/4d6ad51f8a9354d8e62cf8d66db97bd991b7d93c/src/Microsoft.AspNetCore.Authentication.JwtBearer/LoggingExtensions.cs#L20 and do as you are for ErrorProcessingMessage You are receiving this because you were mentioned. |
Ah got it. This would need to be fixed for RC2. |
@kichalla could you start an internal thread to initiate the approval? :) |
Created a new issue on Security repo aspnet/Security#794, so closing this now. Thanks! @sreicht for reporting the issue. |
We created an own ILogger and iterate thru each KeyValuePair in the state object.
We are also using the JwtBearer token authentication. Each time when the authentication is successful a Logger.Define() without any paramter is called.
https://github.com/aspnet/Security/blob/4d6ad51f8a9354d8e62cf8d66db97bd991b7d93c/src/Microsoft.AspNetCore.Authentication.JwtBearer/LoggingExtensions.cs#L37
When iterating thru the ReadOnlyList an ArgumentOutOfRangeException will be thrown because the count of _formatter.ValueNames is zero.
https://github.com/aspnet/Logging/blob/release/src/Microsoft.Extensions.Logging.Abstractions/LoggerMessage.cs#L298
The text was updated successfully, but these errors were encountered: