Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing VALUETUPLE check #1711

Merged
merged 1 commit into from Jul 27, 2022
Merged

add missing VALUETUPLE check #1711

merged 1 commit into from Jul 27, 2022

Conversation

SimonCropp
Copy link
Contributor

@SimonCropp SimonCropp commented Jul 27, 2022

VALUETUPLE was being used but not defined in any constants

#if VALUETUPLE
            if (definition == typeof(ValueTuple<>) || definition == typeof(ValueTuple<,>) ||
                definition == typeof(ValueTuple<,,>) || definition == typeof(ValueTuple<,,,>) ||
                definition == typeof(ValueTuple<,,,,>) || definition == typeof(ValueTuple<,,,,,>) ||
                definition == typeof(ValueTuple<,,,,,,>))
#else
            // ReSharper disable once PossibleNullReferenceException
            if (definition.FullName is
                "System.ValueTuple`1" or
                "System.ValueTuple`2" or
                "System.ValueTuple`3" or
                "System.ValueTuple`4" or
                "System.ValueTuple`5" or
                "System.ValueTuple`6" or
                "System.ValueTuple`7")
#endif

@SimonCropp
Copy link
Contributor Author

side note is there any real value in doing type check here? wouldn't definition.FullName.StartsWith("System.ValueTuple``" suffice

@skomis-mm
Copy link
Contributor

skomis-mm commented Jul 27, 2022

Looks good 👍

wouldn't definition.FullName.StartsWith("System.ValueTuple``" suffice

I think since we constrain max length of the tuple to 8 for destructuring, type name checks against interned strings should perform a bit better than StartsWith(..)

@nblumhardt nblumhardt merged commit 9f0c43c into serilog:dev Jul 27, 2022
@SimonCropp SimonCropp deleted the add-missing-VALUETUPLE-check branch July 28, 2022 02:27
@nblumhardt nblumhardt mentioned this pull request Sep 12, 2022
Twinki14 pushed a commit to Twinki14/CitizenFX.Extensions.Client.Serilog that referenced this pull request Dec 30, 2023
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.

None yet

3 participants