public static void LoadType([NotNull] Type type, [NotNull] FixAttribute attribute) { Assert.ArgumentNotNull(type, nameof(type)); Assert.ArgumentNotNull(attribute, nameof(attribute)); var i = type.GetInterface(fixInterface); if (i == null) { return; } IFix fix; try { var constructorInfo = type.GetConstructor(Type.EmptyTypes); if (constructorInfo == null) { return; } fix = constructorInfo.Invoke(null) as IFix; } catch { Trace.TraceError("Fix threw an exception in the constructor"); return; } if (fix == null) { Trace.TraceError("Fix does not have a parameterless constructor"); return; } var descriptor = new FixDescriptor(attribute, fix); Add(descriptor); }
public static void Add([NotNull] FixDescriptor fixDescriptor) { Assert.ArgumentNotNull(fixDescriptor, nameof(fixDescriptor)); fixes.Add(fixDescriptor); }