Fix Export crash from leftover OWIN dependency #6592
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes to be committed:
modified: Rock/Web/UI/Controls/Grid/Grid.cs
Proposed Changes
This PR removes a leftover OWIN dependency inside the Actions_ExcelExportClick method in Rock/Web/UI/Controls/Grid/Grid.cs.
Starting in Rock McKinley v17, the OWIN hosting pipeline was removed. However, the Excel export logic still attempts to call:
Context?.GetOwinContext()?.Request?.CallCancelled
On any Rock instance running 17.6+, this results in the following runtime exception whenever a grid is exported to Excel:
InvalidOperationException: No owin.Environment item was found in the context.
This prevents all Excel exports system-wide.
Fix:
The OWIN call has been replaced with a safe fallback:
var cancellationToken = CancellationToken.None;
This removes the dependency on OWIN entirely and restores Excel export functionality on all affected grids.
Why this fix is needed:
• OWIN was removed in Rock 17+
• The old GetOwinContext() call now always throws
• Excel exports crash in all grids
• Replacing the call restores expected behavior with no side effects
Fixes: #
Types of changes
• Bugfix (non-breaking change which fixes an issue)
• New feature
• Breaking change
Checklist
• This is a single-commit PR
• Verified no whitespace/formatting changes
• I have read the Contributing to Rock documentation
• I agree to license my contribution under the Rock Community License Agreement
• Unit tests pass locally
• Added unit/integration tests if appropriate
• Documentation updated if appropriate
Further comments
This issue affects all Excel export functionality on any installation upgraded to Rock 17.6+, including Early Access builds. Since the OWIN pipeline no longer exists, any call to GetOwinContext() will always fail. This minimal fix removes the OWIN dependency and restores normal grid export behavior.
Documentation
No end-user documentation changes required.
Migrations
No migration is required.