As to your latest symptoms -- using reflection, I suspect you are still reflecting the old type, which has been unloaded.
I tried the following code and if you use the new Type of the newly loaded add-in, you won’t have exception.
IEntryPoint addIn = addInToken[0].Activate<IEntryPoint>(AddInSecurityLevel.FullTrust);
addIn.Initialize(this.serviceProvider);
addIn.InitializeDataBindings();
addIn.FinishInitialization();
IExtendedMultipleEntryPoint addinEx = addIn as IExtendedMultipleEntryPoint;
Collection<object> epObjects = addinEx.GetEntryPointObjects();
object addinObject = epObjects[0];
Type objType = addinObject.GetType();
PropertyInfo[] propInfos = objType.GetProperties();
bool isClass = propInfos[0].PropertyType.IsClass;
//@@PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(addinObject.GetType());
AddInController aic = AddInController.GetAddInController(addIn);
addIn.OnShutdown();
aic.Shutdown();
IEntryPoint addIn2 = addInToken[0].Activate<IEntryPoint>(AddInSecurityLevel.FullTrust);
addIn2.Initialize(this.serviceProvider);
addIn2.InitializeDataBindings();
addIn2.FinishInitialization();
IExtendedMultipleEntryPoint addinEx2 = addIn2 as IExtendedMultipleEntryPoint;
Collection<object> epObjects2 = addinEx2.GetEntryPointObjects();
object addinObject2 = epObjects2[0];
bool useNewType = true;
if (useNewType)
{
Type objType2 = addinObject2.GetType();
PropertyInfo[] propInfos2 = objType2.GetProperties();
bool isClass2 = propInfos2[0].PropertyType.IsClass;
object[] objs = propInfos2[0].PropertyType.GetCustomAttributes(false);
}
else
{
PropertyInfo[] propInfos2 = objType.GetProperties();
bool isClass2 = propInfos2[0].PropertyType.IsClass;
}