Skip to content

ROCK-9041 Dispose ContentStream in AzureBlobStorage.SaveContent - #18

Closed
stphnlee wants to merge 1 commit into
hotfix-1.16.12from
bugfix-sl-ROCK9041-AzureBlobDispose-v16
Closed

stphnlee wants to merge 1 commit into
hotfix-1.16.12from
bugfix-sl-ROCK9041-AzureBlobDispose-v16

Conversation

@stphnlee

@stphnlee stphnlee commented Sep 28, 2026 •

Copy link
Copy Markdown

Summary

Fork patch for ROCK-9041. After migrating file types to Rock core's AzureBlobStorage provider, the Process Signature Documents job failed with:

System.IO.IOException: The process cannot access the file 'F:\Rock\wwwroot\App_Data\Cache\SignNow\....pdf' because it is being used by another process.
   at Rock.Model.SignatureDocumentTemplateService.UpdateDocumentStatus(...)

UpdateLegacyProviderDocumentStatus assigns a FileStream to BinaryFile.ContentStream, saves, then calls File.Delete() on the temp file. The Database and FileSystem providers dispose ContentStream inside SaveContent, but AzureBlobStorage.SaveContent did not, so the file handle stayed open and the delete threw.

Change

Rock/Storage/Provider/AzureBlobStorage.cs → SaveContent(BinaryFile, out long?): wrap the upload in using ( var stream = binaryFile.ContentStream ) so the stream is disposed after upload, matching the contract of the other two providers. fileSize is read inside the block before dispose.

Testing

  • Rock.csproj builds clean (0 errors).
  • Needs runtime verification per the ticket's acceptance criteria: Process Signature Documents job completes on the Azure provider, temp files in App_Data\Cache\SignNow are removed, and regular uploads / profile photos / contribution statement PDFs still save to Azure.

Follow-ups (not in this PR)

  • Revert the signature document file type from the Pillars provider back to core Azure once deployed.
  • File upstream with Spark.
  • Plugin-side fix in org.secc.SignNowWorkflow SignNowDownload (separate RockPlugins PR).

🤖 Generated with Claude Code

Wrap the blob upload in a using block so the provider disposes
BinaryFile.ContentStream after saving, matching the Database and
FileSystem providers. Callers that assign a FileStream and then delete
the temp file (SignatureDocumentTemplateService.UpdateDocumentStatus)
were hitting IOException because the handle was still open, which broke
the Process Signature Documents job.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 28, 2026 18:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Disposes Azure Blob Storage content streams after upload, preventing temporary-file locks during signature document processing.

Changes:

  • Wraps upload and file-size retrieval in a using block.
  • Aligns Azure behavior with other storage providers.
File Description
Rock/​Storage/​Provider/​AzureBlobStorage.cs Disposes ContentStream after Azure upload.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@stphnlee

Copy link
Copy Markdown
Author

Not merging to the fork branch. This commit is applied at build time instead via the Azure DevOps pipeline cherry-pick script, pinned to tag secc/ROCK-9041-azureblob-dispose (eb1284d). Branch kept for reference.

@stphnlee stphnlee closed this Sep 28, 2026
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.

2 participants