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

RSRP-469265: Code analysis considers parentheses surrounding a pointer variable as redundant (in unsafe code)

$
0
0
Reporter Andrey Simukov (Andrey.Simukov) Andrey Simukov (Andrey.Simukov)
Created Apr 14, 2018 8:40:17 PM
Updated Apr 14, 2018 8:40:17 PM
Subsystem Code Analysis - C#
Assignee Ivan Serduk (IvanSerduk)
Priority Normal
State Submitted
Type Bug
Fix version No Fix versions
Affected versions 2017.3.5, 2018.1
Fixed In Version ReSharper Undefined
VsVersion All Versions
Reproduced for all the 3 cases below (2017.3.5 and 2018.1 EAP 8).

public static unsafe byte[] GetBytes(this float obj)
{
    float* x = &obj;
    var n = (*x).GetBytes();
    var m = (*&obj).GetBytes();
    var k = (*(float*)&obj).GetBytes();
    return n;
}

Without "Remove redundant parentheses" inspection the context action is available:


With "Remove redundant parentheses" inspection the Quick-fix is suggested as well:

Viewing all articles
Browse latest Browse all 106942

Trending Articles