Open
Description
Analyzer package
Microsoft.CodeAnalysis.FxCopAnalyzers
Package Version
v2.9.4
Diagnostic ID
Repro steps
using System.Runtime.InteropServices;
class Program
{
static void Main() { }
private const int SomeLength = 16;
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct SomeStruct
{
internal fixed byte FixedBuffer[SomeLength];
}
}
Expected behavior
No warnings.
Actual behavior
The CA1823 analyzer flags the SomeLength const as being unused:
Program.cs(7,23,7,33): warning CA1823: Unused field 'SomeLength'.
even though obviously it is being used.