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

  • SEARCH
  • Home
  • 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 6884443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:30:32+00:00 2026-05-27T05:30:32+00:00

I have this in my code: Assembly assembly = Assembly.LoadFile(dllFile); //dllFile has the correct

  • 0

I have this in my code:

Assembly assembly = Assembly.LoadFile(dllFile);
//dllFile has the correct value of a path of a .dll file
foreach (Type type in assembly.GetTypes()) {...}

When I debug my program, everything works fine. When I create the exe for my program, the code comes to assembly.GetTypes() and stops executing. What could cause assembly.GetTypes() to work differently when I’m debugging from when I’m using the exe?

  • 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-05-27T05:30:33+00:00Added an answer on May 27, 2026 at 5:30 am

    Take a look at this link:

    http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/3bdaf65c-520c-4a1a-a825-fc2ca2957bf3/

    You should never use Assembly.LoadFile(). Use LoadFrom() if you know
    where the assembly is located, use Load() to let .NET figure out where
    the assembly is located. Using Load() should be your preference but
    may require a .config file to help .NET find the assembly

    credit to @HansPassant

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

Sidebar

Related Questions

OK, I have the following bit of code: Assembly assembly = Assembly.LoadFile(W:\\AssemblyFoo.dll); foreach (Type
I have this code to register dlls into my gac Assembly asm = Assembly.LoadFrom(argument);
I have this kind of code in some applications (from microsoft) [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( Microsoft.Naming,
I have this code while($row = mysql_fetch_row($result)) { echo '<tr>'; $pk = $row[0]['ARTICLE_NO']; foreach($row
I have a WPF project where I load a WindowsForsm assembly (dll file) dynamically
Code excerpt: var a = Assembly.LoadFile(MyAssembly.dll); var t = a.GetType(MyNamespace.MyClass, false); Debug.Assert(t != null);
I have a code like this public static Type ToType(XmlSerializableType xmlSerializableType) { string func
I have this code in jQuery, that I want to reimplement with the prototype
I have this code: chars = #some list try: indx = chars.index(chars) except ValueError:
I have this code that performs an ajax call and loads the results into

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.