How do I list all loaded assemblies?
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
Listing all loaded assemblies in a .NET process is useful for debugging dependency issues, plugin loading, version conflicts, and runtime diagnostics. The standard answer is AppDomain.CurrentDomain.GetAssemblies(), but it also helps to understand what "loaded" really means and when some assemblies may not appear yet.
The Basic API
The simplest way to list loaded assemblies is:
This returns the assemblies currently loaded into the application's default AppDomain.
What "Loaded" Means
Assemblies are usually loaded on demand. If code has never referenced a library and nothing else forced it to load, it may not appear in the list yet.
That means the output is a snapshot of runtime state, not a list of every assembly the application could possibly use. This distinction matters when debugging lazy-loaded plugins or optional features.
Useful Details to Print
Often the assembly name alone is not enough. Common details worth printing include:
- simple name
- version
- full name
- physical path
This is especially useful when you suspect a version mismatch or duplicate dependency load.
Watching Future Loads
If you want to know when assemblies are loaded later during runtime, subscribe to the load event:
This is useful in plugin hosts, test runners, or large applications where assemblies appear long after startup.
.NET Core and Load Contexts
In modern .NET, AppDomain.CurrentDomain.GetAssemblies() is still the common practical answer, but assembly loading can also involve multiple AssemblyLoadContext instances. That matters mainly in advanced scenarios such as plugin isolation.
If you are debugging one of those systems, remember that an assembly may be loaded in a specific context for isolation reasons. The everyday listing API is still helpful, but the broader load-context design may explain behavior that looks surprising.
Tools Outside Code
You do not always need to write code for this. IDE and diagnostic tools can also show loaded assemblies or modules while debugging. Those views are helpful when you need a quick look without changing the program source.
Code is still the best choice when you need logging in production or inside an automated diagnostic path.
Logging for Runtime Diagnostics
If assembly issues happen only in customer environments, logging the loaded assemblies at startup can save a lot of guesswork. A compact runtime dump of names, versions, and paths often makes version conflicts obvious much faster than reading project files.
Common Pitfalls
- Expecting unloaded but referenced assemblies to appear in the list.
- Printing only simple names and missing version conflicts.
- Assuming one assembly name means one version, even when multiple contexts or copies exist.
- Forgetting that single-file deployments and runtime loading strategies can affect
Location. - Using assembly lists as if they were a complete dependency graph rather than a runtime snapshot.
Summary
- '
AppDomain.CurrentDomain.GetAssemblies()is the usual way to list loaded assemblies.' - The list reflects what is loaded now, not every assembly the app could ever use.
- Print version and path information when debugging dependency issues.
- Use the
AssemblyLoadevent if you want to observe future loads. - For advanced plugin scenarios, assembly load contexts can matter too.
Related reading
- How do I make a WinForms app go Full Screen
- How do I make calls to a REST API using C?
- How do I monitor clipboard content changes in C?
- How do I open an already opened file with a .net StreamReader?
- How do I programmatically get the GUID of an application in C with .NET?
- How do I pronounce as used in lambda expressions in .Net
- How do I reference a .NET Framework project in a .NET Core project?
- How do I remedy The breakpoint will not currently be hit. No symbols have been loaded for this document. warning?

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.