Introduction
Finding the assemblies loaded in the current AppDomain.
Explanation
Today I am going to show you a problem solving issue. We normally create separate assemblies (i.e, DLLs)
and reference them to the main application. In this process the most common issue is we have coded a logic in our DLL but it is not applied/running through the main
application… as many people ask me how to fix this issue, I decided to post this solution… The issue is simple and the cause of the issue may be two reasons:
- Your DLL may not be updated in your main application.
- You may code in one location and refer from another location in your main application.
These two are most common issues, the first will be raised if you are manually copying the DLL from the bin folder of your component project to your main application bin folder. If you do this, every time you change your component you need to
repeat this process. If you forget to update, the above issue will occur. A better option is, while adding the reference to your component select the
component project instead of selecting the DLL in your bin folder. This will automatically update your component DLL in your main application’s bin folder
whenever a change is done. This way we can fix the first cause of the issue.
The second cause is straightforward and most people suffer from this issue. To fix this issue we need to know from where the respective component is picked by the CLR. We can
do this using the Modules window in Visual Studio 2010. To open this window, go to Debug->Windows->Modules as shown below.
Note: This will be visible while running the application.
Now you will see the below window with grid of Assemblies loaded
In this window, you can find all the information regarding your component: from where it is loaded and etc.. Using this we can fix another issue too as many people cannot debug
their components in the main application. The reason for this is your main application doesn’t have the respective components symbol file, i.e.., .pdb file
and in this modules window, you can find if the CLR picks its symbol file or not. If not just copy the latest one to your main application’s bin folder
and build and restart the application.