I'm working on the Code Fix provider for .Net.
I'd like to check method internals, e.g. method statements from IMethodSymbol.
As an example, I have following code on input:
public void DoSomething(string input)
{
if(input == null)
throw new InvalidOperationException("!!!!");
}
On the code-fix side I have IMethodSymbol interface, and there are not ability to get method statements, internal nodes, etc. (I'd like to see 'if', condition into the 'if', exception raising, etc).
How can I get it?
Use the DeclaringSyntaxReferences
property to get the syntax tree defining the method.
Partial methods will have two nodes.
Methods defined in metadata (referenced assemblies) won't have any.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With