Finding What Are the Assemblies Are Loaded Currently in Current AppDomain

Determining what assemblies are currently loaded in the current AppDomain

Today I am going to show you a problem-solving issue; generally, in the past we used to create separate assemblies (i.e, dll's) and reference them to the main application; in this process the most common issue is that we have logic coded in our dll but its not applied/running through the main application. Since many people ask me how to fix this issue, I may posting this. The issue is simple and the cause of the issue may be either of two reasons; those are:

  1. Your dll may not be updated in you main application.
  2. You may code in one location and refer from another location in your main Application.

These two are the most common issues; the first will occur if you manually copy 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 do the update then the above issue will occur. For this, 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.

Clipboard01.jpg

The second cause is straight-forward and most people suffer from this kind of issue. To fix this issue we need to know from where the respective component is picking 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.

mn.jpg

Now you will see the following window with a grid of Assemblies loaded:

Clipboard03.jpg

In this window you can find all the information regarding your component from where it was loaded 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 that your main application doesn't have the respective components symbol file; i.e.., a .pdb file and in this modules window what you can find is whether the CLR picks its symbol file or not. If not then just copy the latest one into your main application's bin folder and build and restart the application.