Suzanne Cook's .NET CLR Notes

Common Language Runtime Developer

Channel 9 Interview

Charles Torre and Robert Scoble (behind the camera) dropped by my office to chat with me about the...

Author: Suzanne Cook - Microsoft Date: 02/11/2005

New Assembly, Old .NET (and Vice-Versa)

I typically recommend that you build and test your assemblies against the same version of .NET that...

Author: Suzanne Cook - Microsoft Date: 01/26/2005

Versioning/Deploying Unmanaged Files

An unmanaged dll can be wrapped in a managed assembly by adding it as a file of a multi-module...

Author: Suzanne Cook - Microsoft Date: 10/28/2004

Load(AssemblyName)

Calling Load(AssemblyName) is not necessarily the same as calling Load(String). If the...

Author: Suzanne Cook - Microsoft Date: 08/04/2004

Debugging an InvalidCastException

First, obviously, find the two types for which the cast failed and verify that they are the same...

Author: Suzanne Cook - Microsoft Date: 06/02/2004

App.config Examples

Below are three examples of useful application configuration files. Forces the v1.0 CLR to be run....

Author: Suzanne Cook - Microsoft Date: 05/14/2004

Determining Whether a File Is an Assembly

A file is an assembly if and only if it's managed and it contains an Assembly entry in its CLR...

Author: Suzanne Cook - Microsoft Date: 03/18/2004

Debugging a MissingMethodException, MissingFieldException, TypeLoadException

Say you've just installed some assemblies from a third party and now you're seeing a...

Author: Suzanne Cook - Microsoft Date: 02/13/2004

Where to Find Technical Support

Microsoft's official support website is https://support.microsoft.com/. It has all kinds of resources...

Author: Suzanne Cook - Microsoft Date: 12/05/2003

Determining the Referencing Assembly

Say you're debugging your application and you see that version 1.0 of an assembly is being loaded...

Author: Suzanne Cook - Microsoft Date: 11/15/2003

LoadFile vs. LoadFrom

Be careful - these aren't the same thing. LoadFrom() goes through Fusion and can be redirected to...

Author: Suzanne Cook - Microsoft Date: 09/19/2003

LoadFrom's Second Bind

Pre-v2, when you load an assembly by path through Fusion (LoadFrom(), ExecuteAssembly(), etc.), it...

Author: Suzanne Cook - Microsoft Date: 09/16/2003

Avoid DevPath

I hesitate to talk about this because I don't want people who don't know about it to think, "Hey,...

Author: Suzanne Cook - Microsoft Date: 08/15/2003

ReflectionTypeLoadException

If a type can't be loaded for some reason during a call to Module.GetTypes(),...

Author: Suzanne Cook - Microsoft Date: 08/11/2003

Binding to .NET Frameworks Assemblies

By "Frameworks assemblies," I mean the assemblies that ship with the CLR. But, I'm not counting...

Author: Suzanne Cook - Microsoft Date: 07/30/2003

Assembly Identity

There are two types of assembly identity that the loader deals with: bind-time and after bind-time....

Author: Suzanne Cook - Microsoft Date: 07/21/2003

Unloading an Assembly

There's no way to unload an individual assembly without unloading all of the appdomains containing...

Author: Suzanne Cook - Microsoft Date: 07/08/2003

Mscorlib.dll

At least for v2 and earlier, mscorlib.dll is a special case. That causes it and its types to be...

Author: Suzanne Cook - Microsoft Date: 06/30/2003

Assembly.CodeBase vs. Assembly.Location

The CodeBase is a URL to the place where the file was found, while the Location is the path from...

Author: Suzanne Cook - Microsoft Date: 06/26/2003

Determining an Image’s CLR Version

To get it programmatically, from managed code, use Assembly.ImageRuntimeVersion. From unmanaged, use...

Author: Suzanne Cook - Microsoft Date: 06/20/2003

AppDomain.Load()

AppDomain.Load() is only meant to be called on AppDomain.CurrentDomain. (It's meant for interop...

Author: Suzanne Cook - Microsoft Date: 06/16/2003

Switching to the Load Context

So, after checking out the binding context options, you've decided to switch your app to use the...

Author: Suzanne Cook - Microsoft Date: 06/13/2003

Executing Code in Another AppDomain

The easiest way to run code in another appdomain is to execute an assembly entrypoint using...

Author: Suzanne Cook - Microsoft Date: 06/12/2003

App.Config Files

By default, the application configuration file of the default appdomain (and other appdomains for...

Author: Suzanne Cook - Microsoft Date: 06/02/2003

Avoid Partial Binds

A partial bind is when only part of the assembly display name is given when loading an assembly....

Author: Suzanne Cook - Microsoft Date: 05/30/2003

Using Type.GetType(typeName)

If no assembly is specified, Type.GetType() will only look in the calling assembly and then...

Author: Suzanne Cook - Microsoft Date: 05/30/2003

When to Change File/Assembly Versions

First of all, file versions and assembly versions need not coincide with each other. I recommend...

Author: Suzanne Cook - Microsoft Date: 05/30/2003

Choosing a Binding Context

There are three 'contexts' for assembly binding: Load context In general, if the assembly was found...

Author: Suzanne Cook - Microsoft Date: 05/29/2003

Assembly Display Names

An assembly display name should include the assembly simple name, version, culture and public key...

Author: Suzanne Cook - Microsoft Date: 05/29/2003

Debugging Assembly Loading Failures

So...you're seeing a FileNotFoundException, FileLoadException, BadImageFormatException or you...

Author: Suzanne Cook - Microsoft Date: 05/29/2003