Hi, thanks for sharing this.
The code above seems to work fine for me (can't reproduce the issue).
Is it possible that there is a mismatch between the System.Threading.Tasks.Task type being returned and the one expected by the runner? This could be caused by an assembly referencing issue. Do you have two different versions of this class present within the application domain? You can try the
preload assembly references setting to see if this helps.
Edit: I've just reviewed the code involved here. NCrunch will throw this exception under the following conditions:
1. If the return value from the async test is null
2. If the return value does not have a full type name of "System.Threading.Tasks.Task" and does not inherit from a type with this name.
Maybe you can try hooking a debugger onto the test and examining its return result. I'm not sure why this is different in your environment compared with mine. Do you get this with a small sample project?