0

Codelens in Visual Studio is great, but I've inherited a code base where some methods are invoked via reflection.

This is a simplified sample.

...
if (method.Name.EndsWith("UpdatePlatformModel");
     method.Invoke(element, parameters)
...

enter image description here

In the attached image, the codelens states the method has 0 (zero) references. I understand that since this is invoked at runtime, the reference number won't reflect the number of times the method is called.

Is there a way via Visual Studio, a third party plugin, or any other strategy, where I can analyze the code to identify if a method is referenced or not?

2
  • C# calls methods through reflection. "method.Invoke(element, parameters)". You can run it in the main method. Commented Aug 30, 2022 at 2:43
  • @Housheng-MSFT, can you elaborate a bit further to make sure I fully understand your response? Thanks Commented Sep 2, 2022 at 14:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.