Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8405789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:55:18+00:00 2026-06-09T22:55:18+00:00

What does assembly GetTypes() do behind the scenes? Assuming an assembly has been loaded

  • 0

What does assembly GetTypes() do behind the scenes? Assuming an assembly has been loaded to the AppDomain does it still need to read from the physical DLL? And what the assembly manifest do?

Iterating through the assembly like this:

AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()) 

I’m occasionally getting the following error:

 Could not load file or assembly 

Which tells me that because an assembly is loaded into the AppDomain it’s not necessarily fully loaded to memory. Sometimes it still needs to go back to the file.

My questions:

  1. Why is it doing that?
  2. What can I do to detect these semi-loaded assemblies?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:55:20+00:00Added an answer on June 9, 2026 at 10:55 pm

    Getting a type from a assembly may require additional assemblies to be loaded so that is most probably the reason for the error; a failure to load a dependent assembly. However a .NET assembly may be constructed from several modules in different files so I believe you may also face this problem if you have a multifile assembly and one or more of the files are missing or corrupt.

    Associated with the error you should get more information about the specific assembly that could not be loaded.

    If you just want to load a list of the loadable types in the assembly you can use a extension method like this:

    public static IEnumerable<Type> GetLoadableTypes(this Assembly assembly)
    {
        if (assembly == null) throw new ArgumentNullException(nameof(assembly));
        try
        {
            return assembly.GetTypes();
        }
        catch (ReflectionTypeLoadException e)
        {
            return e.Types.Where(t => t != null);
        }
    }
    

    (Source: Get All Types in an Assembly)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What does Assembly.GetExportedTypes() do? How is it different from Assembly.GetTypes() Can you explain with
DTF does not call the second action if the custom action assembly has more
I've installed SlimDX but the assembly reference does not come up as a choice
Can any user run inline assembly for current linux kernel or does that require
%windir%\Microsoft.NET\assembly\ is the new GAC . Does it mean now we have to manage
Could you please explain what is an Assembly in C# or .NET? Where does
Does COUNT(*) have any significant impact for MySQL performance if query already has GROUP
Im compiling some code at runtime then loading the assembly into the current appdomain,
There is something I cannot understand. I can't read the type reference: Assembly mscorlib
I want to get all of the types from my assembly, but I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.