roslyn: Missing AccessorDeclarationSyntax.ExpressionBody
I’m creating an CodeFixProvider
for an analyzer and stepped on the following issue:
According to the source , AccessorDeclarationSyntax.ExpressionBody
is public
. I can see that property through VS watch, but I can’t access it through my normal code (‘AccessorDeclarationSnytax’ does not contain a definition for ‘ExpressionBody’) - note that this is not an “inaccessible due to its protection level” error. As an expression bodied property accessor contains no Body
(property is null
), I can’t be sure if whether my property is an “auto-prop” or not. Am I missing something here?
Please refer me to the right place to ask this if it’s not here.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 18 (18 by maintainers)
Assembly binding redirection is used to make your analyzers operate against the most recent known version at runtime.
By compiling against Roslyn 1.0.1, you fall into the second point for everything newer than Visual Studio 2015 RTM. With this selection, your analyzer is compatible with the most versions of Visual Studio possible for Roslyn, but you will not be able to specifically analyze C# 7 syntax (because they were added in the Roslyn 2.x API).
When I last tried this migration, I kept hitting issues (which may now be resolved). A pull request was submitted to StyleCop Analyzers which claims to make the change you are requesting, but I haven’t yet reviewed it in detail: DotNetAnalyzers/StyleCopAnalyzers#2327