CSharpEssentials
CSharpEssentials copied to clipboard
CSE0003 is raised on methods which have conditional compilation
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
}
Great bug -- thanks!