Interop effects by resolving and instantiating types with ArcObjects

Problem this code does not work Type t = typeof(ESRI.ArcGIS.Framework.AppRefClass); System.Object obj = Activator.CreateInstance(t); but yet this code Type t...

Problem

this code does not work

Type t = typeof(ESRI.ArcGIS.Framework.AppRefClass);

System.Object obj = Activator.CreateInstance(t);

but yet this code

Type t = Type.GetTypeFromCLSID(typeof(ESRI.ArcGIS.Framework.AppRefClass).GUID);

System.Object obj = Activator.CreateInstance(t);

Reason

In the first variant the runtime tries to cast to AppRefClass . This is not possible.

And in the second one, the runtime does not knows anything about AppRefClass. So it leave it as IUnknown.

(originally communicated by my co-worker Ralf)