Code: Select all
public static async Task CallBackMethod(HttpRequestMessage request, string entityId, Func getEntity, Func action, string actionId) where T : Meta
{
// Changing to ConfigureAwait(true) ensures no Stackoverflow exception
request.Properties[Before] = await getEntity.Invoke(entityId).ConfigureAwait(false);
request.Properties[Target] = typeof(T).Name;
// Custom Exception is thrown from action.Invoke()
await action.Invoke().ConfigureAwait(false);
request.Properties[After] = (Func)(async () => await getEntity.Invoke(entityId).ConfigureAwait(false));
request.Properties[ActionId] = actionId;
}
< /code>
Dann wird die Stackoverflow -Ausnahme nicht ausgelöst. Nur die erwartete benutzerdefinierte Ausnahme wird ausgelöst und behandelt.
Ich dachte Nicht in der Lage herauszufinden, was die Stackoverflow -Ausnahme verursachen könnte. Ich wollte verstehen, was sich zwischen configureAwait (false) und true, dass die Ausnahme von Stackoverflow nicht geworfen wird. P>