CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2002
    Location
    Torture chamber
    Posts
    132

    Something I don't understand. Need help!

    I got 2 modules, a DLL(weakly named) and a client which makes use of the classes defined in the 2 modules.

    Then I modified one of the modules, saved it, re-run the client and I got an exception "FileLoadException"!

    Puzzled, I thought in weakly named assembly, no version checking is done and it will automatically use the new module...

    I am using the .NET SDK with SP1. Any explanations for these....
    end------------------------------
    Programmers aren't born, but are made from hardwork, effort and time.
    To be a good one, requires more effort and hardwork.
    Therefore N quality programmer = (N*hardwork)+(N*effort)+(N*time)

  2. #2
    Join Date
    Oct 2002
    Location
    Atlanta, GA
    Posts
    97
    Was there any other information given with that exception? I believe it is thrown when a file is found but cannot be loaded. What did you change? If you change it BACK, does it work again, or do you still receive the FileNotFound exception now?

  3. #3
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125
    If you don't give an assembly a strong name, then the compiler generates a weak name, which changes everytime the item is regenerated (that is why it is weak, it keeps dying!).

    When you go to run the program, it does not find the exact image that it is looking for.

    Once you use a strong name, you are responsible for updating the versioning information. You can build the item over and over again without updating the version information and be able to use the assembly (providing the public interfaces have not changed of course...)
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  4. #4
    Join Date
    Oct 2002
    Location
    Torture chamber
    Posts
    132

    Help needed from a lost soul

    Thank you guys for your replies. It helps though.

    What I did to resolve it:
    I used the AL to relink the DLL with the new module.

    But this generated some new questions:

    1) I've heard alot of assembly thingy. But what exactly is an assembly? A module, the client or the whole thing is an assembly.Unfortunately the book does explains it very well on that part.

    2) In chapter one of the book Programming .NET, it states that when the compiler detected the module to be the assembly, it will attach the manifest to it's metadata Thus I presumed that the term "assembly" is the client. Consider the illustration:

    Client
    {Client's Metadata contains manifest}
    / | \
    / | \
    module1 jpg module2
    {metadata} {metadata}


    So, based on the diagram, we can create a DLL with the 2 modules, but what actually is a DLL and what's it role?

    (3)I learnt from the book that the DLL has a hashtable so does the modules it linked in their respective metadata. The hashtable plays an important role during verification to prevent tampering. Is that correct?
    end------------------------------
    Programmers aren't born, but are made from hardwork, effort and time.
    To be a good one, requires more effort and hardwork.
    Therefore N quality programmer = (N*hardwork)+(N*effort)+(N*time)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured