seesharper/LightInject

Collection was modified

seesharper opened this issue · 0 comments

Observed in a asp.net app

[21:52:57] :	 [Step 1/1]    System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
[21:52:57] :	 [Step 1/1]   Stack Trace:
[21:52:57] :	 [Step 1/1]      at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
[21:52:57] :	 [Step 1/1]    at Microsoft.Extensions.Options.OptionsMonitor`1.Dispose()
[21:52:57] :	 [Step 1/1]    at LightInject.Scope.Dispose()
[21:52:57] :	 [Step 1/1]    at LightInject.Microsoft.DependencyInjection.LightInjectServiceProvider.Dispose()
[21:52:57] :	 [Step 1/1]    at Microsoft.Extensions.Hosting.Internal.Host.<DisposeAsync>g__DisposeAsync|16_0(Object o)
[21:52:57] :	 [Step 1/1]    at Microsoft.Extensions.Hosting.Internal.Host.DisposeAsync()
[21:52:57] :	 [Step 1/1]    at Microsoft.Extensions.Hosting.Internal.Host.Dispose()
[21:52:57] :	 [Step 1/1]    at Microsoft.AspNetCore.Mvc.Testing.DeferredHostBuilder.DeferredHost.Dispose()
[21:52:57] :	 [Step 1/1]    at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.DisposeAsync()
[21:52:57] :	 [Step 1/1]    at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.Dispose(Boolean disposing)
[21:52:57] :	 [Step 1/1]    at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.Dispose()

Possibly related

https://stackoverflow.com/questions/9925083/collection-was-modified-enumeration-operation-may-not-execute