Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-469240: Incorrect "the field is not accessed" on the struct.

$
0
0
Reporter Denis A. Gladkiy (DrollerTroller) Denis A. Gladkiy (DrollerTroller)
Created Apr 12, 2018 9:09:54 AM
Updated Apr 12, 2018 6:27:32 PM
Subsystem Code Analysis - C#
Assignee Ivan Serduk (IvanSerduk)
Priority Normal
State Submitted
Type Bug
Fix version No Fix versions
Affected versions 2017.3
Fixed In Version ReSharper Undefined
VsVersion All Versions

Consider the code:

internal struct StichingLineId
{
private readonly string _patternUid;
private readonly int _patternIndex;
private readonly int _patchIndex;
private readonly bool _outlineLocated;
internal StichingLineId([NotNull] string patternUid, int patternIndex, int patchIndex, bool outlineLocated)
{
_patternUid = patternUid;
_patternIndex = patternIndex;
_patchIndex = patchIndex;
_outlineLocated = outlineLocated;
}
}

Rider says that the fields are not accessed and offers to remove them.

But in C# struct's fields are used by default GetHashCode and Equals methods implementation. And I'm not considering cases with unknown to the analyser usages: reflection, unsafe or native code. This is part of the language specification.

Version: RD-173.3994.1125
Timezone: Asia/Krasnoyarsk
Evaluation: false
Environment: RD-173.3994.1125, JRE 1.8.0_152-release-1024-b10x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1920x1080


Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>