Where to Find Technical Support

Microsoft’s official support website is http://support.microsoft.com/. It has all kinds of resources like product FAQs, downloads, searchable KB articles, newsgroup pointers, and ways to reach people to help with your individual needs or feedback. Unfortunately, I can’t give attention to individual customer issues. That’s because I work in product design and development, not customer support….

14

Determining the Referencing Assembly

Say you’re debugging your application and you see that version 1.0 of an assembly is being loaded when you thought it should be version 2.0. Where is the reference to 1.0 coming from? The easiest way to find out is to look at the Fusion log for this bind. If the version 1.0 assembly was…

2

LoadFile vs. LoadFrom

Be careful – these aren’t the same thing. LoadFrom() goes through Fusion and can be redirected to another assembly at a different path but with that same identity if one is already loaded in the LoadFrom context. LoadFile() doesn’t bind through Fusion at all – the loader just goes ahead and loads exactly* what the…

12

LoadFrom’s Second Bind

Pre-v2, when you load an assembly by path through Fusion (LoadFrom(), ExecuteAssembly(), etc.), it can actually cause two binds, not just one. The first bind loads the file at the given path. If that is successful, another bind is done with the display name of that assembly to see if it’s available in the Load…

2

Avoid DevPath

I hesitate to talk about this because I don’t want people who don’t know about it to think, “Hey, what’s this DevPath thing? I need that.” But, maybe if I don’t explain how to use it, it will be too much effort for people who don’t already know how. 🙂 (And, for those who already…

16

ReflectionTypeLoadException

If a type can’t be loaded for some reason during a call to Module.GetTypes(), ReflectionTypeLoadException will be thrown. Assembly.GetTypes() also throws this because it calls Module.GetTypes(). The Message for this exception is “One or more exceptions have been thrown while loading the types” or “Unable to load one or more of the types in the…

11

Binding to .NET Frameworks Assemblies

By “Frameworks assemblies,” I mean the assemblies that ship with the CLR. But, I’m not counting mscorlib.dll, since it’s special in a different way. With v1.0 SP3 or later, Frameworks assemblies are unified. That means that the version of those assemblies that you request is ignored – you get the version that matches the loaded…

3

Assembly Identity

There are two types of assembly identity that the loader deals with: bind-time and after bind-time. The identity is used to determine whether we will consider a certain assembly to be the same thing as an assembly reference or another assembly. Assembly Binding At assembly-bind time, the components of the assembly display name determine identity….

16

Unloading an Assembly

There’s no way to unload an individual assembly without unloading all of the appdomains containing it. (See here for why not.) This can by done by calling AppDomain.Unload() for each AppDomain that has it loaded. (You could also use UnloadDomain() on the v1 unmanaged hosting API, but in general, I recommend using managed code whenever…

30

Mscorlib.dll

At least for v2 and earlier, mscorlib.dll is a special case. That causes it and its types to be loaded differently from other assemblies. Loading Mscorlib.dll Without a Path It and the execution engine are so closely integrated that it’s required that they match each other. So, once a version of the CLR is chosen,…

28