Skip to content

Code built against TextFilter 1.5.x/1.6.x throws MissingMethodException on 1.7.x: the case-sensitivity parameter replaced the IsMatch/Filter/DoesMatchGlob signatures instead of adding overloads #155

Closed

Description

@matt-edmondson

What's wrong

#97/#98 added TextFilterCaseSensitivity caseSensitivity = CaseSensitive as a trailing optional parameter and shipped it as a minor version. That changed the signatures of existing public methods in TextFilter/TextFilter.cs:

  • Filter, both overloads
  • IsMatch, both overloads
  • DoesMatchGlob and DoesMatchRegex
  • AnyTokenMatchesGlobFilter and AllTokensMatchGlobFilter

Default values for optional parameters are filled in at the call site at compile time. So the old 4-parameter IsMatch(string, string, TextFilterType, TextFilterMatchOptions) no longer exists in the binary, and an assembly compiled against it can no longer find it. CompatibilitySuppressions.xml holds only TFM-related CP0001 entries, and package validation against a previous version is not enabled, so nothing caught the break.

Reproduced

BlastMerge pins ktsu.TextFilter 1.5.48. Building it and then running its PathExclusionMatcher.Matches with TextFilter 1.7.14 swapped in throws:

System.MissingMethodException: Method not found: 'Boolean ktsu.TextFilter.TextFilter.IsMatch(System.String, System.String, ktsu.TextFilter.TextFilterType, ktsu.TextFilter.TextFilterMatchOptions)'.

Failure scenario

An application references a library compiled against TextFilter ≤ 1.6 (such as BlastMerge) and also references TextFilter ≥ 1.7, directly or through another package. NuGet resolves to the highest version, so 1.7 is the one that loads. The first time the older library filters anything, it crashes. This is the situation a minor version bump promises cannot happen.

Suggested fix

  • Restore the pre-1.7 signatures as non-optional overloads that forward with TextFilterCaseSensitivity.CaseSensitive.
  • Avoid overload ambiguity in new code: either make caseSensitivity required in the new overloads, or keep it optional and mark the restored overloads [EditorBrowsable(EditorBrowsableState.Never)].
  • Optionally enable package validation (EnablePackageValidation with PackageValidationBaselineVersion set to the last 1.6.x) so CI catches the next break.

Acceptance criteria

  • An assembly compiled against 1.5.48 or 1.6.x runs against the new version without MissingMethodException.
  • Existing source still compiles and resolves to the case-sensitivity overloads without ambiguity errors.

Activity

  1. added
    bug
    on Oct 28, 2026
  2. matt-edmondson commented on Oct 28, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

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

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions