-
Notifications
You must be signed in to change notification settings - Fork 16
fix: add RequestDelegate to ExceptionMiddleware constructor #333
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
Conversation
The middleware was using primary constructor syntax but was missing the RequestDelegate next parameter, causing dependency injection to fail at runtime with InvalidOperationException. Fixed by adding RequestDelegate next as the first parameter in the primary constructor and removing it from InvokeAsync method signature, which is the correct pattern for ASP.NET Core middleware.
WalkthroughThe ExceptionMiddleware class is refactored to follow the standard ASP.NET Core middleware pattern by moving the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.cs📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
⚙️ CodeRabbit configuration file
Files:
⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |



The middleware was using primary constructor syntax but was missing the RequestDelegate next parameter, causing dependency injection to fail at runtime with InvalidOperationException.
Fixed by adding RequestDelegate next as the first parameter in the primary constructor and removing it from InvokeAsync method signature, which is the correct pattern for ASP.NET Core middleware.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.