Skip to content

Pre-release cleanups#272

Open
oschwald wants to merge 17 commits intomainfrom
greg/eng-4362
Open

Pre-release cleanups#272
oschwald wants to merge 17 commits intomainfrom
greg/eng-4362

Conversation

@oschwald
Copy link
Member

@oschwald oschwald commented Mar 6, 2026

  • Modernize AssemblyVersion management
  • Fix ArrayPool leak on deserialization exceptions
  • Fix null-safety in MemoryMapBuffer.Dispose
  • Update release notes wording for Parameter rename
  • Update README for 5.0 changes
  • Clean up suppressions and fill justifications
  • Minor code cleanup
  • Update CI and docs
  • Fix error message and exception type consistency in Reader
  • Extract IPv4-in-IPv6 prefix length as named constant
  • Improve ParameterAttribute obsolete message
  • Update release script to sync all project versions
  • Remove stale AnkhSVN metadata from solution file
  • Fill empty param docs on Metadata constructor
  • Fix insert_final_newline editorconfig setting
  • Use NuGet v3 package source
  • Refresh test/benchmark metadata and drop manual file version

oschwald and others added 4 commits March 6, 2026 14:48
Remove manual AssemblyVersion/AssemblyFileVersion from AssemblyInfo.cs
and let the SDK auto-generate AssemblyFileVersion from VersionPrefix.
Pin AssemblyVersion in csproj for strong-naming stability. Update
release.sh to keep AssemblyVersion in sync with major version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wrap ArrayPool Rent/Return in try/finally in DecodeMapToType and
SetAlwaysCreatedParams so rented arrays are returned even when
deserialization throws.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add null checks for _view in Dispose(bool) to prevent
NullReferenceException if constructor fails after _memoryMappedFile
is assigned but before _view is created.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The ParameterAttribute is kept as an obsolete compat shim, so this
isn't a breaking change. Soften wording accordingly. Keep BREAKING
on InjectAttribute.ParameterName which was fully removed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request encompasses a series of pre-release cleanups and minor enhancements aimed at improving the overall quality, maintainability, and robustness of the project. Changes include modernizing project configurations, addressing potential resource leaks and null-safety concerns, updating documentation for API changes, and streamlining the build and release processes. The updates contribute to a more stable and developer-friendly codebase.

Highlights

  • Assembly Versioning: Modernized assembly version management by centralizing version definition in .csproj files and updating the release script to synchronize versions across projects.
  • Resource Management: Fixed a potential ArrayPool leak in Decoder.cs by ensuring rented arrays are returned even during deserialization exceptions, and improved null-safety in MemoryMapBuffer.Dispose.
  • Documentation & API Clarity: Updated documentation and release notes to reflect the [Parameter] attribute's deprecation in favor of [MapKey], and enhanced README.md with a new example for property-based deserialization.
  • Code Quality & Consistency: Cleaned up and justified existing code analysis suppressions, refined error messages and exception types in the Reader class, and standardized editor configuration.
  • Dependency & Build Process: Updated the NuGet package source to use the v3 API and removed stale AnkhSVN metadata from the solution file.
  • Readability & Maintainability: Extracted the IPv4-in-IPv6 prefix length into a named constant for better readability and maintainability, and filled in missing XML documentation for the Metadata constructor.
Changelog
  • .editorconfig
    • Updated the insert_final_newline setting to true.
  • CLAUDE.md
    • Removed deprecated buffer layer components (Buffer and ArrayBuffer) from the architectural description.
    • Updated the async database loading example to remove the explicit FileAccessMode.Memory parameter.
  • MaxMind.Db.Benchmark/MaxMind.Db.Benchmark.csproj
    • Removed a specific PlatformTarget configuration for Debug|net45|AnyCPU.
  • MaxMind.Db.Benchmark/Properties/AssemblyInfo.cs
    • Updated assembly metadata (Title, Description, Company, Product, Copyright).
    • Removed the AssemblyFileVersion attribute.
  • MaxMind.Db.Test/GlobalSuppressions.cs
    • Refined and justified various code analysis suppressions.
    • Removed several outdated suppression entries.
  • MaxMind.Db.Test/Helper/NonSeekableStreamWrapper.cs
    • Ensured proper base class disposal by adding a call to base.Dispose(disposing).
  • MaxMind.Db.Test/Properties/AssemblyInfo.cs
    • Updated assembly metadata (Title, Description, Company, Product, Copyright).
    • Removed the AssemblyFileVersion attribute.
  • MaxMind.Db.sln
    • Removed outdated AnkhSVN source control binding metadata from the solution file.
  • MaxMind.Db/Decoder.cs
    • Implemented try-finally blocks around ArrayPool.Shared.Rent and Activator calls to prevent ArrayPool leaks during deserialization.
  • MaxMind.Db/GlobalSuppressions.cs
    • Updated justifications for existing code analysis suppressions.
  • MaxMind.Db/MapKeyAttribute.cs
    • Updated the Obsolete message for ParameterAttribute to clarify its future removal.
  • MaxMind.Db/MaxMind.Db.csproj
    • Removed GenerateAssemblyVersionAttribute and GenerateAssemblyFileVersionAttribute.
    • Added AssemblyVersion property set to 5.0.0 for centralized versioning.
  • MaxMind.Db/MemoryMapBuffer.cs
    • Added null-conditional operators (?) when calling ReleasePointer() and Dispose() on _view during disposal to improve null-safety.
  • MaxMind.Db/Metadata.cs
    • Provided detailed XML documentation for all parameters in the Metadata constructor.
  • MaxMind.Db/Properties/AssemblyInfo.cs
    • Removed explicit AssemblyVersion and AssemblyFileVersion attributes.
  • MaxMind.Db/Reader.cs
    • Removed unused System.Linq import.
    • Introduced IPv4PrefixInIPv6Tree as a named constant for the IPv4-in-IPv6 prefix length.
    • Changed _metadataStartMarker field to static readonly.
    • Replaced hardcoded 96 with the IPv4PrefixInIPv6Tree constant in node traversal logic.
    • Changed InvalidDataException to InvalidDatabaseException for invalid search tree errors.
    • Improved IPv4 byte array creation for ReaderIteratorNode to avoid Skip().Take().ToArray().
    • Updated the error message for a corrupt MaxMind DB search tree.
  • NuGet.Config
    • Updated the nuget.org package source URL to use the NuGet v3 API endpoint.
  • README.md
    • Updated references from [MaxMind.Db.Parameter("name")] to [MaxMind.Db.MapKey("name")].
    • Added a new section demonstrating property-based decoding to a model class.
  • dev-bin/release.sh
    • Modified the script to update VersionPrefix in all .csproj files.
    • Added logic to set the AssemblyVersion in MaxMind.Db.csproj based on the major version.
  • releasenotes.md
    • Revised the wording for the [Parameter] attribute rename, clarifying its obsolescence rather than immediate removal.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/codeql-analysis.yml
Activity
  • No human activity (comments, reviews, approvals) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a wide range of cleanups and improvements in preparation for a new release. Key changes include modernizing version management, fixing an ArrayPool leak, improving null safety, updating documentation and release scripts, and cleaning up code analysis suppressions. The changes are generally excellent and improve the quality and maintainability of the codebase. I have one minor suggestion regarding code formatting.

oschwald and others added 13 commits March 6, 2026 15:50
Update [Parameter] reference to [MapKey] and add a property-based
activation example alongside the existing constructor-based one.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all <Pending> justifications with real explanations in both
project GlobalSuppressions.cs files. Remove stale CA1052/S1118
suppressions for now-static DecoderTest, remove S3881 suppression
for NonSeekableStreamWrapper and fix the code instead by adding
base.Dispose(disposing) call. Remove merge conflict comment blocks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make _metadataStartMarker static readonly to avoid per-instance
allocation. Replace LINQ .Skip(12).Take(4).ToArray() with Array.Copy
in FindAll to avoid iterator allocations. Remove unused System.Linq
import. Remove stale net45 condition block from benchmark csproj.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 10.0.x to CodeQL workflow dotnet-version list. Fix CLAUDE.md:
remove stale ArrayBuffer/Buffer references (everything is
MemoryMapBuffer now) and fix CreateAsync example signature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace vague "Something bad happened" with a descriptive message
about search tree corruption. Change InvalidDataException to
InvalidDatabaseException in FindAll for consistency — all database
format errors should use the library's own exception type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace magic number 96 with IPv4PrefixInIPv6Tree constant and add
a comment explaining its significance in the MaxMind DB format.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Include migration guidance and removal timeline in the obsolete
message so users see actionable information in compiler warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Have release.sh update VersionPrefix in Test and Benchmark csproj
files alongside the main library, keeping versions consistent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The SubversionScc section is a leftover from when the project used
Subversion. It has no effect on the Git-based workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add descriptions to all 9 constructor parameters, mirroring the
existing property documentation for IntelliSense completeness.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change insert_final_newline from false to true, resolving the
conflict with roslynator_new_line_at_end_of_file = true.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant