John Lam 1997 — 2026

Assembly Friendship

[Via Charles Cook] Jim Hogg from the CLR team talks about an upcoming new feature in V2 of the CLR: “Friend Assemblies”. There will be a new assembly-level attribute called InternalsVisibleTo that lets the author of an assembly specify who it wants its internal methods to be visible to.

This is extremely useful for unit-testing. There are many occasions where you need to make the internals of a class visible to unit-testing code. Today, this essentially forces you to have to conditionally compile your unit-testing code into the same assembly as the code that it tests. In V2, you will be able to cleanly separate the code from its tests. It also enables a scenario where InternalsVisibleTo can be used to allow diagnostic code to run against a shipping assembly at a customer site.