I have a desktop application I'm developing with Visual Studio where I need to update a small part of the app on a more frequent basis. To avoid the inconvenience of deploying a new installer every time, I split the more frequently updated support functions into a separate project and compiled it as a DLL. The desktop app now loads this DLL at runtime with reflection and then instantiates the object inside it based on a shared DLL with an interface definition, like this:
Assembly a = Assembly.LoadFrom(supportDLLPath);
ISupportModuleInterface obj = (ISupportModuleInterface)a.CreateInstance("SupportCode.SupportObject");
if (obj != null)
{
obj.OnTransferProgress += new FileTransferProgressHandler(obj_OnTransferProgress);
obj.OnTransferComplete += new EventHandler(uploader_OnTransferComplete);
obj.DoWork(packagePath)
}
It works fine most of the time, but I need to debug an issue with it and I can't reliably get the Visual Studio debugger to step into it. Sometimes when pressing F11 through the code, such as when stepping into DoWork, it will automatically locate the source code for the DLL on my system and display it. However, when an event is fired, Visual Studio just displays the [External Code] marker in the Call Stack and I can't navigate inside the code in the support project.
Does anyone have any ideas on how to fix this so I can properly debug the support project? Thank you!