hmm... I see only Steve attempted to find out the answer to the question; the riddle i posted earlier !
Ok here it is again.
Question : What is the only Type in .NET which has only a non-public constructor and the method body of which throws an exception when invoked ? If so then how is this particular Type instance ever gonna get created ?
Answer : The Type in focus is the internal sealed Type - System.RuntimeType. The only way you can even try to instantiate this, is using Reflection, because the only constructor available is internal. But then again as i said earlier, the constructor would promptly throw you a NotImplementedException saying that the particular Type instance cannot be created ! hmm now ain't that a googly ?
As Steve said, there is magic that goes on in the background, weilded by the CLR Runtime all the while. Ok let me give you a little background on how i arrived at this particular discovery. Now before seeing this particularly weird thing, i was sure that you could serialize a Type information ( System.Type ) or rather the Type metadata somehow so that incase if say in a service someone wanted to create an instance of a particular Type, then he could create the object, serialize it along with the Type information which would mean that whoever would consume the serialized representation can now have both the Type metadata and the object instance of the Type too on the other end. <Rant>I know it sounds weird and strange and cranky ( whoa ) but these thoughts are what led me to this. </Rant>
Now the problem of trying to serialize the Type is that when you call Object.GetType(), it internally calls the FastGetExistingType() or InternalGetType(), unmanaged C++ methods which takes care of finding out the exact Type information of the most derived object instance and returns the System.RuntimeType which represents the Type in question. So even if we try to serialize the data, we will be serializing only the RuntimeType instance and not the exactly the System.Type instance. (Ain't that cool, the Runtime can deceive :) ) I even serialized the RuntimeType instance which i get from GetType() ( dont ask me how yet ), but i was not able to create an instance of the RuntimeType again because it kept throwing me an exception... Here's where it all started ..
Reflector came to the rescue and i started digging into RuntimeType. It was throwing an exception in the method body of the only non-public non-static constructor (internal) available. Any Object in the CLR sense, as far as i could figure out is the combination of Object.H, Object.CPP and Object.CS. Now the Runtime somehow handles the object instance and creates a handle, RuntimeTypeHandle, a pointer to the COR_EE struct of the object which will have the Type metadata in memory. The RuntimeType returned from GetType() call is basically a managed pointer to this memory location.
Basically, i went further on debugging the Rotor source code but then got completely lost when the realm of the CLR starts blurring and bleeding its boundaries into the unmanaged side ... hmm this is where i would like people from MS to extend a helping hand and explain the exact Type allocation, object initialialization and other stuff ! I definitely think that is a reasonable request to ask from the creators of the runtime right ?!
PS : Ok i could have confused things a bit here but i think you can get the picture !
<Frustration>aarghh, why cant people read minds ??</Frustration>