Tightening build errors by warnings as errors and making more build time issues#1214
Merged
adamhathcock merged 28 commits intomasterfrom Feb 16, 2026
Merged
Tightening build errors by warnings as errors and making more build time issues#1214adamhathcock merged 28 commits intomasterfrom
adamhathcock merged 28 commits intomasterfrom
Conversation
…ig-errors # Conflicts: # src/SharpCompress/Common/Zip/ZipFilePart.cs # src/SharpCompress/Compressors/BZip2/BZip2Stream.cs
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (36 files)
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens build quality by enabling warnings as errors and fixing numerous code quality issues that were previously allowed. The changes remove dead code, improve resource management with proper disposal patterns, standardize parameter naming, introduce a ThrowHelper utility for consistent null checks, and ensure culture-invariant string operations.
Changes:
- Enabled stricter compiler analysis by removing RunAnalyzersDuringLiveAnalysis/RunAnalyzersDuringBuild suppressions
- Removed obsolete DeflateCompressionLevel property and updated tests to use CompressionLevel
- Added ThrowHelper utility class for consistent argument validation across .NET versions
- Improved resource disposal with proper using declarations for IDisposable types
- Removed extensive debug code, unused fields, and nullable suppressions throughout the codebase
Reviewed changes
Copilot reviewed 221 out of 221 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Directory.Build.props | Enabled analyzer warnings during build and live analysis |
| src/SharpCompress/ThrowHelper.cs | New helper class for argument validation across .NET versions |
| src/SharpCompress/Writers/Zip/ZipWriterEntryOptions.cs | Removed obsolete DeflateCompressionLevel property |
| tests/**/*.cs | Added using declarations, removed commented debug code, updated to use CompressionLevel |
| src/**/Async.cs | Improved async disposal patterns with proper base.DisposeAsync() calls |
| src/**/*.cs | Removed #nullable disable pragmas, unused fields, debug code, added using declarations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces a number of improvements to code analysis, analyzer configuration, and code quality in both the build system and main source code. The most significant changes include stricter analyzer enforcement, enhanced culture-invariant string handling, and improvements to async and memory handling in both configuration and implementation.
Analyzer configuration and enforcement:
.editorconfighave been made stricter, with several suggestions promoted to errors (e.g., culture-sensitive operations, string comparison, logging, memory allocation, and async usage). This helps enforce higher code quality and consistency across the codebase.src/, relaxed or disabled analyzers forbuild/scripts, and more lenient rules fortests/.Build and analyzer infrastructure:
<RunAnalyzersDuringLiveAnalysis>and<RunAnalyzersDuringBuild>fromDirectory.Build.props, likely to ensure analyzers always run during builds and live analysis is not explicitly disabled.Culture-invariant and string handling improvements:
build/Program.cs, allToLower()and string operations now explicitly specifyCultureInfo.InvariantCultureorStringComparison.Ordinalto avoid culture-specific bugs and improve reliability. [1] [2] [3] [4] [5]src/SharpCompress/Archives/ArchiveVolumeFactory.cs,ToString()now uses a default culture info for consistent string formatting.Async and exception handling improvements:
build/Program.cs, exception handling for git commands is now more precise, throwingInvalidOperationExceptioninstead of a genericException.ifstatements for better readability and maintainability.src/SharpCompress/Archives/GZip/GZipArchive.Async.cs, simplified async writer construction, removing unnecessary options wrapping.General code robustness:
These changes collectively improve code reliability, maintainability, and enforce higher standards for both production and test code.