public void CheckAssemblySCValidity(Assembly asm) { Type[] types = null; bool flag = true; ArrayList list = null; RegistrationServices services = new RegistrationServices(); try { types = asm.GetTypes(); } catch (ReflectionTypeLoadException exception) { types = exception.Types; } foreach (Type type in types) { if (((null != type) && type.IsClass) && type.IsSubclassOf(typeof(ServicedComponent))) { if (!services.TypeRequiresRegistration(type) && !type.IsAbstract) { flag = false; if (list == null) { list = new ArrayList(); } RegistrationErrorInfo info = new RegistrationErrorInfo(null, null, type.ToString(), -2147467259); list.Add(info); } ClassInterfaceType classInterfaceType = ServicedComponentInfo.GetClassInterfaceType(type); foreach (MethodInfo info2 in type.GetMethods()) { if (ReflectionCache.ConvertToInterfaceMI(info2) == null) { if (ServicedComponentInfo.HasSpecialMethodAttributes(info2)) { this.ReportWarning(Resource.FormatString("Reg_NoClassInterfaceSecure", type.FullName, info2.Name)); } if ((classInterfaceType == ClassInterfaceType.AutoDispatch) && ServicedComponentInfo.IsMethodAutoDone(info2)) { this.ReportWarning(Resource.FormatString("Reg_NoClassInterface", type.FullName, info2.Name)); } } } } } if (!flag) { RegistrationErrorInfo[] errorInfo = (RegistrationErrorInfo[])list.ToArray(typeof(RegistrationErrorInfo)); throw new RegistrationException(Resource.FormatString("Reg_InvalidServicedComponents"), errorInfo); } }
private static RegistrationErrorInfo[] BuildErrorInfoChain(ICatalogCollection coll) { RegistrationErrorInfo[] infoArray2; try { Populate(coll); int num = coll.Count(); RegistrationErrorInfo[] infoArray = null; if (num > 0) { infoArray = new RegistrationErrorInfo[num]; for (int i = 0; i < num; i++) { string majorRef = null; string minorRef = null; int errorCode = 0; ICatalogObject obj2 = (ICatalogObject)coll.Item(i); string name = (string)obj2.GetValue("Name"); errorCode = (int)obj2.GetValue("ErrorCode"); majorRef = (string)obj2.GetValue("MajorRef"); minorRef = (string)obj2.GetValue("MinorRef"); infoArray[i] = new RegistrationErrorInfo(majorRef, minorRef, name, errorCode); } } infoArray2 = infoArray; } catch (Exception exception) { if ((exception is NullReferenceException) || (exception is SEHException)) { throw; } throw new RegistrationException(Resource.FormatString("Reg_ErrCollectionErr"), exception); } return(infoArray2); }
private static RegistrationErrorInfo[] BuildErrorInfoChain(ICatalogCollection coll) { RegistrationErrorInfo[] infoArray2; try { Populate(coll); int num = coll.Count(); RegistrationErrorInfo[] infoArray = null; if (num > 0) { infoArray = new RegistrationErrorInfo[num]; for (int i = 0; i < num; i++) { string majorRef = null; string minorRef = null; int errorCode = 0; ICatalogObject obj2 = (ICatalogObject) coll.Item(i); string name = (string) obj2.GetValue("Name"); errorCode = (int) obj2.GetValue("ErrorCode"); majorRef = (string) obj2.GetValue("MajorRef"); minorRef = (string) obj2.GetValue("MinorRef"); infoArray[i] = new RegistrationErrorInfo(majorRef, minorRef, name, errorCode); } } infoArray2 = infoArray; } catch (Exception exception) { if ((exception is NullReferenceException) || (exception is SEHException)) { throw; } throw new RegistrationException(Resource.FormatString("Reg_ErrCollectionErr"), exception); } return infoArray2; }
internal RegistrationException(string msg, RegistrationErrorInfo[] errorInfo, Exception inner) : base(msg, inner) { this._errorInfo = errorInfo; }
public void CheckAssemblySCValidity(Assembly asm) { Type[] types = null; bool flag = true; ArrayList list = null; RegistrationServices services = new RegistrationServices(); try { types = asm.GetTypes(); } catch (ReflectionTypeLoadException exception) { types = exception.Types; } foreach (Type type in types) { if (((null != type) && type.IsClass) && type.IsSubclassOf(typeof(ServicedComponent))) { if (!services.TypeRequiresRegistration(type) && !type.IsAbstract) { flag = false; if (list == null) { list = new ArrayList(); } RegistrationErrorInfo info = new RegistrationErrorInfo(null, null, type.ToString(), -2147467259); list.Add(info); } ClassInterfaceType classInterfaceType = ServicedComponentInfo.GetClassInterfaceType(type); foreach (MethodInfo info2 in type.GetMethods()) { if (ReflectionCache.ConvertToInterfaceMI(info2) == null) { if (ServicedComponentInfo.HasSpecialMethodAttributes(info2)) { this.ReportWarning(Resource.FormatString("Reg_NoClassInterfaceSecure", type.FullName, info2.Name)); } if ((classInterfaceType == ClassInterfaceType.AutoDispatch) && ServicedComponentInfo.IsMethodAutoDone(info2)) { this.ReportWarning(Resource.FormatString("Reg_NoClassInterface", type.FullName, info2.Name)); } } } } } if (!flag) { RegistrationErrorInfo[] errorInfo = (RegistrationErrorInfo[]) list.ToArray(typeof(RegistrationErrorInfo)); throw new RegistrationException(Resource.FormatString("Reg_InvalidServicedComponents"), errorInfo); } }