Click to See Complete Forum and Search --> : Something I don't understand. Need help!


savagerx
January 12th, 2003, 12:11 PM
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....

dfb78
January 13th, 2003, 06:45 AM
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?

TheCPUWizard
January 13th, 2003, 07:19 AM
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...)

savagerx
January 14th, 2003, 12:03 PM
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?