Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EvaluateAsync execution for Action doesnt throw internal exception #231

Open
ivan-luxoft opened this issue Oct 3, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@ivan-luxoft
Copy link
Contributor

Implementations ContextEvaluatorExtensions.EvaluateAsync for async Action uses the next method:

public static Task EvaluateAsync<TBLLContext, TDTOMappingService>(this IContextEvaluator<TBLLContext, TDTOMappingService> contextEvaluator, DBSessionMode sessionMode, string customPrincipalName, Func<EvaluatedData<TBLLContext, TDTOMappingService>, Task> action)
    {
        return contextEvaluator.EvaluateAsync(sessionMode, customPrincipalName, evaluatedData => action(evaluatedData).ContinueWith(_ => default(object)));
    }

that hides internal exception, ASP will not handle the next Exception:

[HttpGet]
    public async Task GetException(
        [FromServices] IContextEvaluator<ICPortalBLLContext> contextEvaluator,
        CancellationToken cancellationToken)
    {
        await contextEvaluator.EvaluateAsync(
            DBSessionMode.Write,
            async c =>
            {
                await Task.Delay(200);
                throw new Exception();
            });
    }
@ivan-luxoft ivan-luxoft added the bug Something isn't working label Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant