Skip to content

Validate ActionBlock constructor inputs - #2

Open
yevhen wants to merge 1 commit into
mainfrom
demo-actionblock-validation
Open

Validate ActionBlock constructor inputs#2
yevhen wants to merge 1 commit into
mainfrom
demo-actionblock-validation

Conversation

@yevhen

@yevhen yevhen commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • fail fast when ActionBlock is configured with zero or negative parallelism
  • reject null processing actions at construction time
  • add regression tests for invalid constructor inputs

Tests

  • dotnet build
  • DOTNET_ROLL_FORWARD=Major dotnet test -v minimal

@yevhen
yevhen force-pushed the demo-actionblock-validation branch from 7ec68c9 to 5395e8e Compare July 7, 2026 20:43

@yevhen yevhen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One requested test coverage follow-up.

@yevhen yevhen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review note: please add missing test coverage for the new action null-validation path.

if (parallelism <= 0)
throw new ArgumentOutOfRangeException(nameof(parallelism), "Parallelism must be greater than 0.");

this.action = action ?? throw new ArgumentNullException(nameof(action));

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a new ArgumentNullException path for action, but the PR only tests invalid parallelism. Could we add a constructor validation test for action: null as well?

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

Successfully merging this pull request may close these issues.

1 participant