Search code examples
c#visual-studioreflectionvisual-studio-2012visual-studio-debugging

Debugging a dll linked to at runtime


For modularity, I am linking to a dll in my solution at runtime rather than compile time to allow for me to update it independently. When I place breakpoints in the library project, these are not triggered when the class is linked to, and a type is created.

For reference, this is the reflection code:

Assembly a = Assembly.LoadFile(FULL_APPLICATION_CACHE + targetVersion + "\\Core.dll");
Type engineCoreType = a.GetType("Core.EngineCore");
object instance = Activator.CreateInstance(engineCoreType);

Is it possible for Visual Studio to offer its normal debugging tools in this scenario? How would I configure this?


Solution

  • You need to make sure the .pdb files are in the same location as the dll you are loading. Visual Studio will then load that data and allow it to stop at break points.