

This is only a bug in the Quick Info. When you look at the generated code, you'll see that it doesn't actually cause a capture.
This makes it a compiler bug and should be on Roslyn instead.
I don't think DataFlowAnalysis.Captured API should report locals inside nameof? if so the fix would be straightforward.
I don't think
DataFlowAnalysis.CapturedAPI should report locals inside nameof? if so the fix would be straightforward.
AFIK, "captured" means implicit closure class and instance has been created.
Actually, it seems that nameof expression never causes capture , so it is inconsistent,it should not be reported.
Most helpful comment
This is only a bug in the Quick Info. When you look at the generated code, you'll see that it doesn't actually cause a capture.
This makes it a compiler bug and should be on Roslyn instead.