WaitHandleCannotBeOpenedException in der Azure-Webrolle beginnen mit Task.Wait ()

Der folgende (Web-) Rolleneinstiegspunkt löst nach der Rückkehr die folgende Ausnahme aus.

public class WebRole : RoleEntryPoint
{
    public override bool OnStart()
    {
        Task.Run(() =>
            {
                // Anything can be here, but the lamdbda can be empty too...
            }).Wait();

        return true;
    }
}

Die Ausnahme

Eine Ausnahme vom Typ "System.Threading.WaitHandleCannotBeOpenedException" ist in "mscorlib.dll" aufgetreten.

Zusätzliche Informationen: Es gibt kein Handle mit dem angegebenen Namen.

Wie ersichtlich wird dies aus dem Framework geworfen. Die Ausnahme scheint harmlos zu sein, es sind keine Probleme aufgetreten.

Noch bin ich gespannt, warum das passiert? Gibt es eine Möglichkeit, in der Rollenstartmethode asynchronen Code auszuführen, der keine solchen Ausnahmen verursacht?

Bearbeiten

Dies ist die Aufrufliste der Ausnahme:

>   mscorlib.dll!System.Threading.EventWaitHandle.OpenExisting(string name, System.Security.AccessControl.EventWaitHandleRights rights) Unknown
    Microsoft.WindowsAzure.ServiceRuntime.dll!Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal() Unknown
    Microsoft.WindowsAzure.ServiceRuntime.dll!Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRole() Unknown
    Microsoft.WindowsAzure.ServiceRuntime.dll!Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.StartRole.AnonymousMethod__2()  Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart()    Unknown
    [Native to Managed Transition]  

Edit 2:

Dies ist die fragliche Azure-Laufzeitquelle:

private void StartRoleInternal()
{
    string environmentVariable = Environment.GetEnvironmentVariable("RdRoleId");
    string name = RoleEnvironment.NormalizeEventName("Global\\started_{0}", environmentVariable);
    try
    {
        using (EventWaitHandle eventWaitHandle = EventWaitHandle.OpenExisting(name, EventWaitHandleRights.Modify))
        {
            eventWaitHandle.Set();
        }
    }
    catch (WaitHandleCannotBeOpenedException)
    {
    }
    RoleEnvironment.TraceSource.TraceEvent(TraceEventType.Information, 203, "Role entrypoint . CALLING   Run(): " + this.role);
    SystemEvents.LogEventToSystemEvents("Windows Azure Runtime 2.3.0.0", RuntimeEventType.OnRoleRunBegin, "Role is running: OnRun(): " + this.role);
    this.role.Run();
    RoleEnvironment.TraceSource.TraceEvent(TraceEventType.Warning, 204, "Role entrypoint . COMPLETED Run() ==> ROLE RECYCLING INITIATED: " + this.role);
    SystemEvents.LogEventToSystemEvents("Windows Azure Runtime 2.3.0.0", RuntimeEventType.OnRoleRunEnd, "Role will recyle: OnRun(): " + this.role);
    RoleEnvironment.RequestRecycle();
}