Is there a way in which I can access the currently loaded code in the debugger from my Visual Studio 2022 extension

41 Views Asked by At

I am trying to develop an extension for Visual Studio 2022 that needs to run a method from a class that is loaded as a .dll file in the current instance of VS while debugging. I want to do something like this:

  1. We don't really care what we are debugging as long as we have access to a library loaded as a .dll file.

  2. Let's say that library contains a class like this one:

class MyDebuggedProgram
{
  public static void MyMethod()
  {
     Console.WriteLine("Hello World");
  }
}
  1. And in the source code of my Visual Studio extension I want to be able to call that code like this:
class MyExampleExtensionClass
{
  public void onBtnClick()
  {
    var resultOfCallingLibraryMethod = SomeMethodThatCallsMyMethod();
  }
}
  1. I want to have access to all the classes, their methods and properties that are loaded in the current program that we are debugging.

Is there an easy way to do this?

0

There are 0 best solutions below