public void Execute() { var freezableTypeFinder = new FreezableTypeFinder(ModuleDefinition, AssemblyResolver); freezableTypeFinder.Execute(); var exceptionFinder = new ExceptionFinder(ModuleDefinition, AssemblyResolver); exceptionFinder.Execute(); var volatileFinder = new VolatileTypeFinder(ModuleDefinition, AssemblyResolver); volatileFinder.Execute(); var volatileFieldFixer = new VolatileFieldFixer(volatileFinder); var fieldInjector = new FieldInjector(volatileFinder, ModuleDefinition.TypeSystem, volatileFieldFixer); var checkIsFrozenBuilder = new CheckIsFrozenBuilder(ModuleDefinition.TypeSystem, exceptionFinder); var freezeCheckerInjector = new FreezeCheckerInjector(ModuleDefinition, fieldInjector, checkIsFrozenBuilder); var typeResolver = new TypeResolver(); var implementsInterfaceFinder = new ImplementsInterfaceFinder(typeResolver); var classes = ModuleDefinition.GetTypes() .Where(x => x.IsClass) .ToList(); var assemblyProcessor = new AssemblyProcessor(freezeCheckerInjector, implementsInterfaceFinder, LogInfo); assemblyProcessor.Execute(classes); volatileFieldFixer.Execute(classes); }
/// <summary>Initializes a new instance of the <see cref="AssemblyMethodContainer"/> class.</summary> /// <param name="assembly">The assembly.</param> public AssemblyMethodContainer(ExceptionFinder exceptionFinder, Assembly assembly) : base() { this.Assembly = assembly; this.ExceptionFinder = exceptionFinder; }
public CheckIsFrozenBuilder(TypeSystem typeSystem, ExceptionFinder exceptionFinder) { this.typeSystem = typeSystem; this.exceptionFinder = exceptionFinder; }
private void Execute(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); bool isUserLogedIn = Authnticator.isUserLogedIn(); if (!isUserLogedIn) { Login login = new Login(); login.Show(); } else { bool isExceptionThrown = ExceptionFinder.isExceptionThrown(); if (!isExceptionThrown) { ErrorService errorService = new ErrorService(); ErrorListProvider errorListProvider = new ErrorListProvider(errorService); IEnumerable <IVsTaskItem> list = VsShellUtilities.GetErrorListItems(errorService); int numberOfErrors = 0; List <string> errorMessages = new List <string>(); errorMessages.Clear(); foreach (var item in list) { string errortext; item.get_Text(out errortext); errorMessages.Add(errortext); numberOfErrors++; } if (numberOfErrors == 0) { MessageBox.Show("Everything is OK... You are good to Go."); } else { foreach (var item in errorMessages) { MessageBox.Show(item); } } } else if (isExceptionThrown) { DTE2 dte = Package.GetGlobalService(typeof(DTE)) as DTE2; string filename = dte.FileName; Solution solution = dte.Solution; string fileName = dte.ActiveDocument.FullName; EnvExtractor envExtractor = new EnvExtractor(); string extionName = envExtractor.detectEnvironoment(fileName); EnvironomentSpecifier environomentSpecifier = new EnvironomentSpecifier(); string envName = environomentSpecifier.getEnvNameByFileExtensionName(extionName); OutputWindowPane outputWindowPane = dte.ToolWindows.OutputWindow.OutputWindowPanes.Item("Debug"); outputWindowPane.TextDocument.Selection.SmartFormat(); outputWindowPane.TextDocument.Selection.SelectAll(); string newText = outputWindowPane.TextDocument.Selection.Text; string[] buildOrder = newText.Split('\n'); int index = 0; int count = 0; foreach (var item in buildOrder) { if (item.Contains("An unhandled")) { index = count; } count++; } exceptionString = buildOrder[index + 1]; // process new output in newText exceptionString = exceptionString + " in " + envName; //MessageBox.Show(exceptionString); Home errorDisplay = new Home(exceptionString); errorDisplay.ShowDialog(); } } }
public void ReadProperty(ExceptionFinder finder, CancellationToken cancelToken) { MethodInfo[] methods = new MethodInfo[] { this.PropertyInfo.GetGetMethod(true), this.PropertyInfo.GetSetMethod(true) }; this.Set = this.Get = null; foreach (MethodInfo mi in methods) { if (mi != null) { Method m = finder.ReadMethod(mi, cancelToken); if (m != null) { foreach (MethodContainer mc in this.CalledMethods) { this.CalledMethods.Add(mc); } this.ThrownExceptions.AddRange(m.ThrownExceptions); this.UnhandledExceptions.AddRange(m.UnhandledExceptions); this.DocumentedThrownExceptions.AddRange(m.DocumentedThrownExceptions); } if (mi.Name.StartsWith("get_")) { this.Get = m; } else { this.Set = m; } } this._complete = true; } }
public void ReadProperty(ExceptionFinder finder, CancellationToken cancelToken) { Method[] methods = new Method[] { this.Get, this.Set }; foreach (Method m in methods) { if (m != null) { if (!m.Complete && (cancelToken != null)) { ExceptionFinder.Instance.ReadMethod(m, cancelToken); } this.CalledMethods.UnionWith(m.CalledMethods); this.UnhandledExceptions.UnionWith(m.UnhandledExceptions); this.DocumentedThrownExceptions.AddRange(m.DocumentedThrownExceptions); } } this._complete = ((this.Get == null) || this.Get.Complete) && ((this.Set == null) || this.Set.Complete); }
/// <summary> /// Initializes a new instance of the <see cref="Class"/> class. /// </summary> /// <param name="exceptionFinder">The exception finder.</param> /// <param name="classType">Type of the class.</param> public Class(ExceptionFinder exceptionFinder, Type classType) { this.ClassType = classType; this.ExceptionFinder = exceptionFinder; }