I cannot understand why the following code will not work:
var task = new Task(() => { });
task.Start();
if (task.Wait(10000))
{
logger.Info(\"Works\");
Thank you everyone for your comments, it helped me be more specific and finally isolate the issue.
I created a test project here: http://erwinmayer.com/dl/TaskTestProject.zip. It shows that the code in my question doesn't work if it runs within the static constructor. But it does work if called directly as a static class method, after the static constructor has been initialized.
This recent MSDN blog post provides some technical insight on the existence of related issues when dealing with multithreading and static constructors: