Click here to Skip to main content
Click here to Skip to main content

Finding the assemblies loaded in the current AppDomain

By , 14 May 2012
 

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: 

  1. Your DLL may not be updated in your main application. 
  2. 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. 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Saikumar Koona
Software Developer (Senior)
India India
I am a Sr.Software Proffessional and iam glad to say that i achive a Technology Specialist from Microsoft in .NET
Follow on   Twitter

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5memberMlsoun14-May-12 19:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130619.1 | Last Updated 14 May 2012
Article Copyright 2012 by Saikumar Koona
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid