Skip to content

fix: fixing issue #19: Configuration throwing exception related to No…#20

Merged
pdevito3 merged 1 commit intopdevito3:mainfrom
AlexMKotcz:fix/NotInOperatorConfiguration
Jan 20, 2024
Merged

fix: fixing issue #19: Configuration throwing exception related to No…#20
pdevito3 merged 1 commit intopdevito3:mainfrom
AlexMKotcz:fix/NotInOperatorConfiguration

Conversation

@AlexMKotcz
Copy link
Copy Markdown
Contributor

After some inspecting, I was able to completely solve the exception for my example provided on issue #19.
This PR was the result.

The behavior before

On ParseFilter, called ReplaceComparisonAliases, then called GetAliasMatches.
On GetAliasMatches, in this line:

        if(aliases.NotInOperator != NotInOperator().Operator())
        {
            matches.Add(new ComparisonAliasMatch { Alias = aliases.NotInOperator, Operator = NotInOperator().Operator() });
            matches.Add(new ComparisonAliasMatch { Alias = $"{aliases.NotInOperator}{caseInsensitiveAppendix}", Operator = $"{NotInOperator(true).Operator()}" });
        }

It added to matches even when not specifying an alias for NotInOperator, because aliases.NotInOperator was null.

Then, in the ReplaceComparisonAliases method, line var escapedAlias = Regex.Escape(comparisonAliasMatch.Alias); throws the exception.

The behavior now

As the NotInOperator is now assigned and not null, the condition on the if is not true (because I didn't provide a custom alias).
Now, the foreach doesn't throws an exception.

Tests

Before
tests-before
After
tests-after

@pdevito3
Copy link
Copy Markdown
Owner

whoops, thanks for this! if you change this to target main, i'll merge it in and do a patch release. I want you to get contribution credit this time!

annoying because i need a develop or equivalent working branch for active and working doc separation, but then stuff normal PRs that i can't always merge in to a release right away won't get contribution... need to look into the right way to do this i'm sure i'm missing something simple.

either way. appreciate the assit and want to make sure you get credit this time!

@AlexMKotcz AlexMKotcz changed the base branch from develop to main January 19, 2024 19:38
@AlexMKotcz
Copy link
Copy Markdown
Contributor Author

Sure! Just did! Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants