private void ProcessTypeDirective(IRootingServiceProvider rootProvider, ModuleDesc containingModule, XElement typeElement) { var typeNameAttribute = typeElement.Attribute("Name"); if (typeNameAttribute == null) { throw new Exception(); } var dynamicDegreeAttribute = typeElement.Attribute("Dynamic"); if (dynamicDegreeAttribute != null) { if (dynamicDegreeAttribute.Value != "Required All") { throw new NotSupportedException(); } } string typeName = typeNameAttribute.Value; TypeDesc type = containingModule.GetTypeByCustomAttributeTypeName(typeName); rootProvider.AddCompilationRoot(type, "RD.XML root"); if (type.IsDefType) { foreach (var method in type.GetMethods()) { // We don't know what to instantiate generic methods over if (method.HasInstantiation) { continue; } // Virtual methods should be rooted as if they were called virtually if (method.IsVirtual) { MethodDesc slotMethod = MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(method); rootProvider.RootVirtualMethodUse(slotMethod, "RD.XML root"); } // Abstract methods have no entrypoints if (method.IsAbstract) { continue; } rootProvider.AddCompilationRoot(method, "RD.XML root"); } } }