IntelliTect / IntelliTect/CodingGuidelines

Document appropriate implementation of `GetHashCode`.

Open
#8 1 comment 1 reaction 0 assignees View on GitHub
documentation
Dominant language
C#
Stars
12
Forks
16
Avg merge
2m
Merged PRs (30d)
7

Description

VS and Rider both flag warnings when you use a property in a `GetHashCode` implementation that is not read-only, however, I recently encountered an issue where one of the properties was virtual. This allowed the property to change in a derived class and alter the base class hash code leading to a failed dictionary lookup.

Solution: flag as warning when virtual member is used in `GetHashCode`

Contributor guide

Open the contributing guide

Research direction

No files or tests are named in the issue. Locate the repository's existing implementation for warnings involving GetHashCode, then inspect how member mutability and virtual members are analyzed; done means a virtual member used by GetHashCode produces a warning without breaking existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.