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

Using OnSuccess/OnFailure Actions within a rule causes a NullReferenceException when the Context is not defined #576

Open
williamb1024 opened this issue Jan 20, 2024 · 0 comments

Comments

@williamb1024
Copy link

If a rule's OnSuccess or OnFailure action's Context is not defined (resulting in a null value), during execution of the rule's action a NullReferenceException is thrown during the construction of the ActionContext instance.

While the builtin Actions require Context information, it is possible that a custom action would not. The action itself should be responsible for handling context information that is missing by detecting missing items within the context dictionary. The action's code should determine if an exception is the proper response.

foreach (var kv in context)

Checking context for null or using a null-coalescing operator would solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant