Skip to content

Why I got IndexOutOfRangeException? #959

@sm-g

Description

@sm-g

I'm using MS ILogger and Serilog 2.4.0 as logger implementation (via Serilog.Extensions.Logging 1.4.0).

When I log string
Got ItemsToPrepare 10:[{9,,General,New,{5,,Our Company},,{,,}},{11,,System Administration,New,{5,,Our Company},,{,,}},{6,,Web site creation,New,{4,,Boston Chocolate},,{,,}},{12,,Finance&Accounting,New,{5,,Our Company},,{,,}},{1,,Web site creation,New,{1,,Media Agency},,{,,}}] for input List`1(10:[{9,General,{5,,Our Company}},{11,System Administration,{5,,Our Company}},{6,Web site creation,{4,,Boston Chocolate}},{12,Finance&Accounting,{5,,Our Company}},{1,Web site creation,{1,,Media Agency}}]) and Id(1) I got IndexOutOfRangeException

   в Serilog.Parsing.MessageTemplateParser.ParsePropertyToken(Int32 startAt, String messageTemplate, Int32& next)
   в Serilog.Parsing.MessageTemplateParser.<Tokenize>d__1.MoveNext()
   в System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   в System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   в Serilog.Events.MessageTemplate..ctor(String text, IEnumerable`1 tokens)
   в Serilog.Parsing.MessageTemplateParser.Parse(String messageTemplate)
   в Serilog.Extensions.Logging.SerilogLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   в Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)

However, logging Got ItemsToPrepare 10:[{1,Robert,,Barber,{4,Administration,False},{-1,New York Office,True},,New,,,},{4,Maurice,,Gibson,{2,Design,False},{2,London Office,True},,New,,,},{5,Jennifer,,Wooster,{4,Administration,False},{-1,New York Office,True},,New,,,},{9,Barbara,,Kloss,{4,Administration,False},{3,Sydney Office,True},,New,,,},{2,Roy,,O'Dowd,{3,Development,False},{-1,New York Office,True},,New,,,}] for input List`1(10:[{1,Robert,,Barber,{4,Administration,False},{-1,New York Office,True}},{4,Maurice,,Gibson,{2,Design,False},{2,London Office,True}},{5,Jennifer,,Wooster,{4,Administration,False},{-1,New York Office,True}},{9,Barbara,,Kloss,{4,Administration,False},{3,Sydney Office,True}},{2,Roy,,O'Dowd,{3,Development,False},{-1,New York Office,True}}]) and Id(1) is OK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions