C# Getting an object's actual TypeDescriptionProvider or TypeDescriptor
<p>I realise that this is an unusual issue, but:</p>

<p>I have created a custom TypeDescriptionProvider that can store and return different <code>TypeDescriptors</code> based on the requested object Type. What I have noticed however is that regardless of the <code>TypeDescriptionProvider</code> associated with a Type (be-it custom or default) the <code>TypeDescriptor.GetProvider()</code> always returns an (internal class) <code>System.ComponentModel.TypeDescriptor.TypeDescriptionNode</code> object (some kind of wrapper around the actual <code>TypeDescriptionProvider</code>). In turn calling <code>GetTypeDescriptor()</code> on this object always returns a <code>System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor</code> object (another wrapper) and stranger still does not call the <code>TypeDescriptionProvider</code>'s actual <code>GetTypeDescriptor()</code> method.</p>

<p>Does this mean that there is really no way to get back either an object's actual <code>TypeDescriptionProvider</code> or its <code>TypeDescriptor</code> from its provider? The methods to return the classname, properties, etc. still work as expected on the <code>DefaultTypeDescriptor</code>, but I am unable to compare or find out if two objects use the same <code>TypeDescriptor</code> (which is what I need currently). </p>

<p>Does anyone know how to either get the actual <code>TypeDescriptionProvider</code>, or get the actual TypeDescriptor from the wrapped provider? </p>

<p>Thank you in advance.</p>

<p>Ex:</p>

<pre><code>public class TestTypeDescriptionProvider : TypeDescriptionProvider
{
    private static Dictionary&lt;Type, ICustomTypeDescriptor&gt; _descriptors = new Dictionary&lt;Type, ICustomTypeDescriptor&gt;();

    ...static method to add to the cache...

    public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
    {
        if (objectType == null)
            return _descriptors[instance.GetType()];

        return _descriptors[objectType];
    }
}

...    

TypeDescriptionProvider p = TypeDescriptor.GetProvider(obj.GetType()); //p is a TypeDescriptionNode

ICustomTypeDescriptor td = p.GetTypeDescriptor(obj); // td is a DefaultTypeDescriptor
</code></pre>
