System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Enumerator.MoveNext()
at Microsoft.Build.BackEnd.BinaryTranslator.BinaryWriteTranslator.TranslateDictionary[D,T](D& dictionary, ObjectTranslator`1 objectTranslator)
at Microsoft.Build.BackEnd.TranslatorHelpers.TranslateDictionary[D,T](ITranslator translator, D& dictionary, NodePacketValueFactory`1 valueFactory)
at Microsoft.Build.Execution.ProjectItemInstance.TaskItem.Microsoft.Build.BackEnd.ITranslatable.Translate(ITranslator translator)
at Microsoft.Build.BackEnd.TranslatorHelpers.Translate[T](ITranslator translator, T& instance, NodePacketValueFactory`1 valueFactory)
at Microsoft.Build.BackEnd.TranslatorHelpers.<>c__DisplayClass1_0`1.<AdaptFactory>g__Translate|0(ITranslator translator, T& objectToTranslate)
at Microsoft.Build.BackEnd.BinaryTranslator.BinaryWriteTranslator.Translate[T](List`1& list, ObjectTranslator`1 objectTranslator)
at Microsoft.Build.BackEnd.TranslatorHelpers.Translate[T](ITranslator translator, List`1& list, NodePacketValueFactory`1 valueFactory)
at Microsoft.Build.BackEnd.LogMessagePacket.TranslateTargetFinishedEvent(ITranslator translator, TargetFinishedEventArgs finishedEvent)
at Microsoft.Build.Shared.LogMessagePacketBase.WriteToStream(ITranslator translator)
at Microsoft.Build.Shared.LogMessagePacketBase.Translate(ITranslator translator)
at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.RunReadLoop(Stream localReadPipe, Stream localWritePipe, ConcurrentQueue`1 localPacketQueue, AutoResetEvent localPacketAvailable, AutoResetEvent localTerminatePacketPump)
Small extra information: I think this is the enumeration that's throwing. I don't see how it could modify the collection, but it seems to be where the call stack is pointing.
Issue Description
Hit by CI: https://dev.azure.com/dnceng/public/_build/results?buildId=1198198&view=logs&jobId=85c53086-d585-50b3-ae0b-d040c710cd82
Stack trace:
Steps to Reproduce
Expected Behavior
Actual Behavior
Analysis
Versions & Configurations
Attach a binlog