Skip to content

Detect Duplicate Extension Registrations #173

Description

@tiksn

Detect Duplicate Extension Registrations

Goal

Detect duplicate serializer extension registrations at startup or first use and report a clear configuration error.

Repository Context

DatabaseEngine builds a FrozenDictionary<string, ISerialization> from all keyed ISerialization services and each serializer's FileExtensions. Duplicate extensions can currently fail with a generic dictionary construction error or produce unclear diagnostics.

Implementation Guidance

  • Validate registered serializer extensions before building the final extension map.
  • Treat extensions case-insensitively.
  • Normalize extensions with a leading dot before comparison.
  • Throw a clear InvalidOperationException or similar configuration exception that includes the duplicate extension and serializer types involved.
  • Apply the same duplicate detection to any supported-format registry if that feature is implemented first.
  • Do not silently choose one serializer over another.

Test Requirements

  • Add a test with two custom serializers claiming the same extension.
  • Add a test with the same extension using different casing.
  • Assert the exception message names the duplicate extension.
  • Assert the exception message identifies the conflicting serializer types.
  • Assert normal built-in registration still succeeds.

Acceptance Criteria

  • Duplicate extension registrations fail clearly and deterministically.
  • Case variants such as .json and .JSON are treated as duplicates.
  • Existing valid registrations continue to work.
  • dotnet test passes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions