Skip to content

Collection was modified in MultiLogger.Log() #576

@KirillOsenkov

Description

@KirillOsenkov

We added logging to catch an intermittent crash in cred provider and finally saw the callstack:

Command-line v1.0.9+1c7de8e6b84724a3f145ae469036d5e57cbcbc61: C:\Users\ContainerAdministrator\.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.dll -Plugin
[04:23:44.140  9088 Verbose] Caught exception processing Initialize  (RequestId: 1947d54d-28e4-42ca-bf64-3e26257b4e0a)
[04:23:44.570  9088 Verbose] System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator.MoveNext()
   at NuGetCredentialProvider.Logging.MultiLogger.Log(LogLevel level, Boolean allowOnConsole, String message) in D:\a\_work\1\s\CredentialProvider.Microsoft\Logging\MultiLogger.cs:line 16
   at NuGetCredentialProvider.Util.ExtensionMethods.Log(ILogger logger, LogLevel logLevel, String message) in D:\a\_work\1\s\CredentialProvider.Microsoft\Util\ExtensionMethods.cs:line 25
   at NuGetCredentialProvider.Util.ExtensionMethods.Verbose(ILogger logger, String message) in D:\a\_work\1\s\CredentialProvider.Microsoft\Util\ExtensionMethods.cs:line 75
   at NuGetCredentialProvider.RequestHandlers.RequestHandlerBase`2.HandleResponseAsync(IConnection connection, Message message, IResponseHandler responseHandler, CancellationToken cancellationToken) in D:\a\_work\1\s\CredentialProvider.Microsoft\RequestHandlers\RequestHandlerBase.cs:line 74

Probably just needs a lock and a ToArray() here:

@embetten FYI

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions