You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After enabling BuildCheck with default settings on roslyn repo , msbuild breaks with:
025-01-15T12:55:54.7713216Z MSBUILD : error MSB4017: The build stopped unexpectedly because of an unexpected logger failure.
2025-01-15T12:55:54.7714414Z Microsoft.Build.Exceptions.InternalLoggerException: The build stopped unexpectedly because of an unexpected logger failure. ---> System.ArgumentException: Source array was not long enough. Check srcIndex and length, and the array's lower bounds.
2025-01-15T12:55:54.7714904Z at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
2025-01-15T12:55:54.7715184Z at System.Collections.Generic.List`1.set_Capacity(Int32 value)
2025-01-15T12:55:54.7715464Z at System.Collections.Generic.List`1.EnsureCapacity(Int32 min)
2025-01-15T12:55:54.7715779Z at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
2025-01-15T12:55:54.7716174Z at Microsoft.Build.Experimental.BuildCheck.Infrastructure.BuildCheckManagerProvider.BuildCheckManager.RemoveCheck(CheckFactoryContext checkToRemove)
2025-01-15T12:55:54.7716640Z at Microsoft.Build.Experimental.BuildCheck.Infrastructure.BuildCheckManagerProvider.BuildCheckManager.RemoveThrottledChecks(ICheckContext checkContext)
2025-01-15T12:55:54.7717172Z at Microsoft.Build.Experimental.BuildCheck.Infrastructure.BuildCheckCentralContext.RunRegisteredActions[T](List`1 registeredCallbacks, T checkData, ICheckContext checkContext, Action`4 resultHandler)
2025-01-15T12:55:54.7717710Z at Microsoft.Build.Experimental.BuildCheck.Infrastructure.BuildEventsProcessor.ProcessTaskFinishedEventArgs(ICheckContext checkContext, TaskFinishedEventArgs taskFinishedEventArgs)
2025-01-15T12:55:54.7718234Z at Microsoft.Build.Experimental.BuildCheck.Infrastructure.BuildCheckManagerProvider.BuildCheckManager.ProcessTaskFinishedEventArgs(ICheckContext checkContext, TaskFinishedEventArgs taskFinishedEventArgs)
2025-01-15T12:55:54.7718823Z at Microsoft.Build.Experimental.BuildCheck.Infrastructure.BuildCheckBuildEventHandler.HandleTaskFinishedEvent(TaskFinishedEventArgs eventArgs)
2025-01-15T12:55:54.7719396Z at Microsoft.Build.Experimental.BuildCheck.Infrastructure.BuildCheckBuildEventHandler.<.ctor>b__5_9(BuildEventArgs e)
2025-01-15T12:55:54.7719933Z at Microsoft.Build.Experimental.BuildCheck.Infrastructure.BuildCheckBuildEventHandler.HandleBuildEvent(BuildEventArgs e)
2025-01-15T12:55:54.7720433Z at Microsoft.Build.Experimental.BuildCheck.Infrastructure.BuildCheckConnectorLogger.EventSource_AnyEventRaised(Object sender, BuildEventArgs e)
2025-01-15T12:55:54.7720866Z at Microsoft.Build.BackEnd.Logging.EventSourceSink.RaiseAnyEvent(Object sender, BuildEventArgs buildEvent)
2025-01-15T12:55:54.7721337Z --- End of inner exception stack trace ---
2025-01-15T12:55:54.7721741Z at Microsoft.Build.Exceptions.InternalLoggerException.Throw(Exception innerException, BuildEventArgs e, String messageResourceName, Boolean initializationException, String[] messageArgs)
2025-01-15T12:55:54.7722227Z at Microsoft.Build.BackEnd.Logging.EventSourceSink.RaiseAnyEvent(Object sender, BuildEventArgs buildEvent)
2025-01-15T12:55:54.7722621Z at Microsoft.Build.BackEnd.Logging.EventSourceSink.RaiseStatusEvent(Object sender, BuildStatusEventArgs buildEvent)
2025-01-15T12:55:54.7723018Z at Microsoft.Build.BackEnd.Logging.EventSourceSink.RaiseTaskFinishedEvent(Object sender, TaskFinishedEventArgs buildEvent)
2025-01-15T12:55:54.7723395Z at Microsoft.Build.BackEnd.Logging.EventSourceSink.Consume(BuildEventArgs buildEvent)
2025-01-15T12:55:54.7723967Z at Microsoft.Build.BackEnd.Logging.EventSourceSink.Consume(BuildEventArgs buildEvent, Int32 sinkId)
2025-01-15T12:55:54.7724486Z at Microsoft.Build.BackEnd.Logging.EventRedirectorToSink.Microsoft.Build.Framework.IEventRedirector.ForwardEvent(BuildEventArgs buildEvent)
2025-01-15T12:55:54.7725070Z at Microsoft.Build.Experimental.BuildCheck.Infrastructure.BuildCheckForwardingLogger.EventSource_AnyEventRaised(Object sender, BuildEventArgs buildEvent)
2025-01-15T12:55:54.7725560Z at Microsoft.Build.Framework.AnyEventHandler.Invoke(Object sender, BuildEventArgs e)
2025-01-15T12:55:54.7725920Z at Microsoft.Build.BackEnd.Logging.EventSourceSink.RaiseAnyEvent(Object sender, BuildEventArgs buildEvent)
2025-01-15T12:55:54.9221835Z Build failed with exit code 1. Check errors above.
Steps to Reproduce
Use PR attached above
Expected Behavior
BuildCheck runs as expected.
Actual Behavior
MSbuild Breaks
Analysis
It looks like the environment modifies _checkRegistry concurrently due to throttling logic
In RemoveChecksAfterExecutedActions the code is processing throttled checks and RemoveCheck method is modifying the _checkRegistry while the FindAll loop is still iterating over it.
Versions & Configurations
sdk 9.0.100
The text was updated successfully, but these errors were encountered:
Issue Description
After enabling BuildCheck with default settings on roslyn repo , msbuild breaks with:
Steps to Reproduce
Use PR attached above
Expected Behavior
BuildCheck runs as expected.
Actual Behavior
MSbuild Breaks
Analysis
It looks like the environment modifies
_checkRegistry
concurrently due to throttling logicmsbuild/src/Build/BuildCheck/Infrastructure/BuildCheckManagerProvider.cs
Line 373 in 4042363
and
msbuild/src/Build/BuildCheck/Infrastructure/BuildCheckManagerProvider.cs
Line 380 in 4042363
In
RemoveChecksAfterExecutedActions
the code is processing throttled checks andRemoveCheck
method is modifying the_checkRegistry
while theFindAll
loop is still iterating over it.Versions & Configurations
sdk 9.0.100
The text was updated successfully, but these errors were encountered: