System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
Stack Trace:
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Serilog.Sinks.InMemory.Assertions.InMemorySinkAssertions.HaveMessage(String messageTemplate, String because, Object[] becauseArgs)
The following line in unit test
sometimes throws an exception as follows:
I guess it will be fixed if
.ToList
is followed by.Where
: https://github.com/sandermvanvliet/SerilogSinksInMemory/blob/master/src/Serilog.Sinks.InMemory.Assertions/InMemorySinkAssertions.cs#L23