CSharpEssentials icon indicating copy to clipboard operation
CSharpEssentials copied to clipboard

CSE0003 is raised on methods which have conditional compilation

Open rmaclean opened this issue 10 years ago • 1 comments

In the following code the CSE0003 warning is raised, implying it should be an expression bodied member when it cannot be because it isn't a single line. Worse is the suggested fix removes code.

private static string DeviceID()
{
#if WINDOWS_PHONE_APP
    var token = Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(null);
    var hardwareId = token.Id;
    var dataReader = DataReader.FromBuffer(hardwareId);

    byte[] bytes = new byte[hardwareId.Length];
    dataReader.ReadBytes(bytes);

    return BitConverter.ToString(bytes);
#endif
#if WINDOWS_UWP
    return " arrgggh Windows 10";
#endif

}

rmaclean avatar Sep 01 '15 11:09 rmaclean

Great bug -- thanks!

DustinCampbell avatar Sep 03 '15 16:09 DustinCampbell