In the .NET BCL there are circular references between:
System.dll
and System.Xml.dll
System.dll
and System.Configuration.dll
System.Xml.dll
and System.Configuration.dll
Here's a screenshot from .NET Reflector that shows what I mean:
How Microsoft created these assemblies is a mystery to me. Is a special compilation process required to allow this? I imagine something interesting is going on here.
A circular reference happens when the dimensions or relations in a part reference another part, and that second part also references the first part. This phenomenon can happen when using “Top Down Modelling” which means parts are designed using the geometry of other parts, to ensure fit.
The circular reference error message "There are one or more circular references where a formula refers to its own cell either directly or indirectly. This might cause them to calculate incorrectly. Try removing or changing these references, or moving the formulas to different cells."
A circular reference occurs when one heap variable contains a reference to a second heap variable, and the second one contains a reference back to the first. For instance, if A is an object, and somewhere in A, there is a reference to B, and within B is a reference back to A, there is a circular reference.
I can only tell how the Mono Project does this. The theorem is quite simple, though it gives a code mess.
They first compile System.Configuration.dll, without the part needing the reference to System.Xml.dll. After this, they compile System.Xml.dll the normal way. Now comes the magic. They recompile System.configuration.dll, with the part needing the reference to System.Xml.dll. Now there's a successful compilation with the circular reference.
In short:
RBarryYoung and Dykam are onto something. Microsoft uses internal tool which uses ILDASM to disassemble assemblies, strip all internal/private stuff and method bodies and recompile IL again (using ILASM) into what is called 'dehydrated assembly' or metadata assembly. This is done every time public interface of assembly is changed.
During the build, metadata assemblies are used instead of real ones. That way cycle is broken.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With