Area-IDEBugFeature - IDE0059IDE-CodeStylehelp wanted
Description
Version Used: 3.3.0-beta3-19413-06+ac06df1bffb7b7fd0e5bf63cc91921af76b21e03
Steps to Reproduce:
using System;
using System.Runtime.InteropServices;
class Program
{
static void Main() => Console.WriteLine(GetTopOfMemory());
private static ulong GetTopOfMemory()
{
var info = new SYSTEM_INFO();
GetSystemInfo(out info);
return (ulong)info.lpMaximumApplicationAddress;
}
[StructLayout(LayoutKind.Sequential)]
internal struct SYSTEM_INFO
{
internal ushort wProcessorArchitecture;
internal ushort wReserved;
internal int dwPageSize;
internal IntPtr lpMinimumApplicationAddress;
internal IntPtr lpMaximumApplicationAddress;
internal IntPtr dwActiveProcessorMask;
internal int dwNumberOfProcessors;
internal int dwProcessorType;
internal int dwAllocationGranularity;
internal short wProcessorLevel;
internal short wProcessorRevision;
}
[DllImport("kernel32")]
internal static extern void GetSystemInfo(out SYSTEM_INFO lpSystemInfo);
}
Execute IDE0059 on the var info = new SYSTEM_INFO(); line.
Expected Behavior: Either:
SYSTEM_INFO info;
GetSystemInfo(out info);
return (ulong)info.lpMaximumApplicationAddress;
or
GetSystemInfo(out SYSTEM_INFO info);
return (ulong)info.lpMaximumApplicationAddress;
or IDE0059 isn't offered at all.
Actual Behavior:
_ = new SYSTEM_INFO();
SYSTEM_INFO info;
GetSystemInfo(out info);
return (ulong)info.lpMaximumApplicationAddress;
which makes no sense, adding the _ = new SYSTEM_INFO();.