docs: Add disposal warning to File.GetStream() (#1509)#1740
Conversation
Add XML documentation to GetStream() method that clearly warns callers they are responsible for disposing the returned FileStream. Includes code examples showing proper usage with 'await using' (async) and 'using' (sync) patterns. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SummaryAdds comprehensive XML documentation to the Critical IssuesMissing logging in While this PR only adds documentation, I noticed the Every other method ( Suggested fix: public FileStream GetStream(FileAccess fileAccess = FileAccess.ReadWrite)
{
LogFileOperation("Opening FileStream: {Path} [Module: {ModuleName}, Activity: {ActivityId}]", this);
return System.IO.File.Open(Path, FileMode.OpenOrCreate, fileAccess);
}This doesn't block the documentation change, but should be addressed separately or as part of this PR. SuggestionsNone - the documentation itself is well-written and follows best practices. Verdict✅ APPROVE - Documentation change is good, but please consider adding logging to |
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive XML documentation to the File.GetStream() method to explicitly warn developers about their responsibility to dispose the returned FileStream. The documentation includes practical code examples demonstrating proper disposal patterns.
- Adds XML documentation with disposal warning
- Includes code examples for both async (
await using) and sync (using) disposal patterns - Prevents potential resource leaks by making API contract explicit
Summary
File.GetStream()method warning that the caller is responsible for disposing the returnedFileStreamawait using(async) andusing(sync) patternsFixes #1509
Test plan
dotnet build src/ModularPipelines/ModularPipelines.csproj -c Release🤖 Generated with Claude Code