JetBrains Rider 2026.2 Help

Code inspection: Value tuple 'GetHashCode()' ignores some elements

This inspection reports GetHashCode() calls on value tuples with more than 8 components. For such tuples, the value tuple hash code is calculated from only the last 8 components, so the first component or components don't contribute to the result. Use a hash-code calculation that includes every value explicitly.

Example

using System; public sealed class OrderKey( int customerId, int regionId, int year, int month, int day, int productId, int channelId, int campaignId, int version) { public override int GetHashCode() { return (customerId, regionId, year, month, day, productId, channelId, campaignId, version).GetHashCode(); } }
using System; public sealed class OrderKey( int customerId, int regionId, int year, int month, int day, int productId, int channelId, int campaignId, int version) { public override int GetHashCode() { var hashCode = new HashCode(); hashCode.Add(customerId); hashCode.Add(regionId); hashCode.Add(year); hashCode.Add(month); hashCode.Add(day); hashCode.Add(productId); hashCode.Add(channelId); hashCode.Add(campaignId); hashCode.Add(version); return hashCode.ToHashCode(); } }

How to fix

This inspection doesn't have a dedicated quick-fix. Replace the tuple-based hash code with an explicit HashCode calculation that includes every component.

13 July 2026