Doesn't work with configurable Enter Play Mode settings
The code heavily expects statics to be cleared between runs, which breaks when you use the faster Play Mode in newer versions of Unity. I have tried to fix this myself but none of my attempts worked (hence the issue instead of a PR, sorry).
I was testing with both Domain and Scene reload disabled.
Reference: https://docs.unity3d.com/Manual/ConfigurableEnterPlayMode.html
If it helps anyone, the problem seems to be in ContinuationProcessorGroup.Add():
var p = ContinuationProcessor<T>.instance;
if(p == null)
{
p = ContinuationProcessor<T>.instance = new ContinuationProcessor<T>(InitialCapacity);
processors.Add(ContinuationProcessor<T>.instance);
}
The static variable ContinuationProcessor<T>.instance isn't reset to null when domain reload is disabled, and therefore isn't added to the new processors list. One solution might be to add a variable to ContinuationProcessor that you could check to see if it's from a previous play session.
Thanks for investigating this. Looks like we need to hook into [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] and reset all static fields to resolve this. I'm not on the right computer to push any code but for future reference, adding something like...
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
static void Initialize()
{
ContinuationProcessor<T>.instance = null;
}
..might help to resolve the issues. I'll work on it when I have access to my dev machine.