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
System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
Stack Trace:
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at JsonApiDotNetCore.Graph.ServiceDiscoveryFacade.AddAssembly(Assembly assembly) in jsonapidotnetcore\src\JsonApiDotNetCore\Graph\ServiceDiscoveryFacade.cs:line 76
The root cause is due to
private static Dictionary<Assembly, List> _identifiableTypeCache = new Dictionary<Assembly, List>();
which is being concurrently updated by different tests (each starting up its own TestServer for tests isolation).
I agree it's not optimal to not be able to run the test concurrently, but they still run pretty quick so it's not really bothering me, therefore I would say this is a pretty low priority issue. Thoughts?
Description
Cannot run concurrent tests using TestServer when using Auto Discovery to register types.
Staetup.cs
services.AddJsonApi(facade => facade.AddCurrentAssembly());
System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
Stack Trace:
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at JsonApiDotNetCore.Graph.ServiceDiscoveryFacade.AddAssembly(Assembly assembly) in jsonapidotnetcore\src\JsonApiDotNetCore\Graph\ServiceDiscoveryFacade.cs:line 76
The root cause is due to
private static Dictionary<Assembly, List> _identifiableTypeCache = new Dictionary<Assembly, List>();
which is being concurrently updated by different tests (each starting up its own TestServer for tests isolation).
see:
JsonApiDotNetCore/src/JsonApiDotNetCore/Graph/TypeLocator.cs
Line 15 in 84f45a9
Environment
The text was updated successfully, but these errors were encountered: