Skip to content

fix: Add null checks for reflection calls#1442

Merged
thomhurst merged 1 commit intomainfrom
fix/1420-null-checks-reflection
Dec 29, 2025
Merged

fix: Add null checks for reflection calls#1442
thomhurst merged 1 commit intomainfrom
fix/1420-null-checks-reflection

Conversation

@thomhurst
Copy link
Owner

Summary

  • Replace null-forgiving operators (!) with explicit null checks and descriptive InvalidOperationException messages in reflection-based method/property lookups
  • Affected files:
    • ModuleExecutor.cs: Added null checks for GetMethod, Invoke, GetProperty, and GetValue reflection calls in ExecuteTypedModule method
    • OptionsProvider.cs: Added null check for service resolution and property access via reflection in GetOptions method

Test plan

  • Build the solution to verify no compilation errors
  • Run unit tests to ensure reflection-based execution still works correctly
  • The changes only add validation - if reflection succeeds as before, behavior is unchanged
  • If reflection fails, descriptive error messages now help diagnose the issue

Closes #1420

🤖 Generated with Claude Code

Closes #1420

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@thomhurst thomhurst merged commit a2d2a76 into main Dec 29, 2025
10 of 11 checks passed
@thomhurst thomhurst deleted the fix/1420-null-checks-reflection branch December 29, 2025 18:33
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.

Add null checks for reflection calls instead of null-forgiving operators

1 participant