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
Test Initial project structure #1 calls WithResolver(), as a part of that by default we suppress auto-registration - this is implemented as an atomic refcount, we add a ref
Test Platform-independent Bitmaps #2 kicks off, it calls WithResolver(false) - we set the resolver, but because the prev ref is still at 1, the new resolver doesn't get initialized
The ThreadStatic trick is definitely like, a compromise
Basically the core idea is, if you try to Set the locator, and you're in a unit test, we'll per-thread set it
If you're in the app, we never do this ThreadStatic bizness
MainThreadScheduler works similarly
So it means you can have two tests who pave Locator at the same time, and they might work, ofc if you schedule a Task everything falls over
But, we make you fall over a little less often
What you really want is "TaskContextStatic", i.e. something that follows the same "context" across a bunch of threads
from @anaisbetts
Consider the following:
The ThreadStatic trick is definitely like, a compromise
Basically the core idea is, if you try to Set the locator, and you're in a unit test, we'll per-thread set it
If you're in the app, we never do this ThreadStatic bizness
MainThreadScheduler works similarly
So it means you can have two tests who pave Locator at the same time, and they might work, ofc if you schedule a Task everything falls over
But, we make you fall over a little less often
What you really want is "TaskContextStatic", i.e. something that follows the same "context" across a bunch of threads
Which I think exists now, but definitely didn't at the time
Maybe this is https://docs.microsoft.com/en-us/dotnet/api/system.threading.asynclocal-1?redirectedfrom=MSDN&view=netframework-4.8?
The text was updated successfully, but these errors were encountered: