Open stephentoub opened 5 years ago
@jinujoseph @vatsalyaagrawal Can we port this issue to Roslyn repo? The issue does not seem specific to this analyzer. Seems like there is no IFieldReferenceOperation
being generated for SomeLength
usage in internal fixed byte FixedBuffer[SomeLength];
.
Even Find All References
also does not seem to find this reference to SomeLength
, and the reference is also not colored as a normal reference would be, so it is very likely that the underlying compiler bound tree does not have a bound node representing this field reference.
Even Find All References also does not seem to find this reference to SomeLength
Yeah, and the Rename support doesn't fix the reference, IDE0051 flags it as unused, Go to Definition on the reference fails, etc.
QuiclInfo doesn't work either. So this is likely a deeper SemanticModel issue, not just an IOp issue.
@CyrusNajmabadi is correct - this is a deeper issue in the compiler layer. Moved to Area-Compilers.
The underlying semantic model issue is likely #29224
FYI, there's an instance of this warning in PR https://github.com/dotnet/runtime/pull/105403 src/libraries/Common/src/Interop/SunOS/procfs/Interop.ProcFs.Definitions.cs Would be nice to remove that pragma once this is fixed. Let me know if a separate issue is wanted for that.
Analyzer package
Microsoft.CodeAnalysis.FxCopAnalyzers
Package Version
v2.9.4
Diagnostic ID
CA1823
Repro steps
Expected behavior
No warnings.
Actual behavior
The CA1823 analyzer flags the SomeLength const as being unused:
even though obviously it is being used.