protected internal virtual void OnWorkspaceFailed(WorkspaceDiagnostic diagnostic) { var ev = _eventMap.GetEventHandlers <EventHandler <WorkspaceDiagnosticEventArgs> >(WorkspaceFailedEventName); if (ev.HasHandlers) { var args = new WorkspaceDiagnosticEventArgs(diagnostic); ev.RaiseEvent(handler => handler(this, args)); } }
private void OnWorkspaceFailed(object sender, WorkspaceDiagnosticEventArgs e) { InvokeBelowInputPriority(() => { var outputPane = this.OutputPane; if (outputPane == null) { return; } outputPane.OutputString(e.Diagnostic.ToString() + Environment.NewLine); }); }
protected internal virtual void OnWorkspaceFailed(WorkspaceDiagnostic diagnostic) { var handlers = this.eventMap.GetEventHandlers <EventHandler <WorkspaceDiagnosticEventArgs> >(WorkspaceFailedEventName); if (handlers.Length > 0) { var args = new WorkspaceDiagnosticEventArgs(diagnostic); foreach (var handler in handlers) { handler(this, args); } } }
private Task RaiseWorkspaceFailedEventAsync(WorkspaceDiagnostic diagnostic) { var handlers = this.eventMap.GetEventHandlers <EventHandler <WorkspaceDiagnosticEventArgs> >(WorkspaceFailedEventName); if (handlers.Length > 0) { return(this.ScheduleTask(() => { var args = new WorkspaceDiagnosticEventArgs(diagnostic); foreach (var handler in handlers) { handler(this, args); } }, "Workspace.WorkspaceFailed")); } else { return(SpecializedTasks.EmptyTask); } }
private static void Workspace_WorkspaceFailed(object sender, Microsoft.CodeAnalysis.WorkspaceDiagnosticEventArgs e) { throw new NotImplementedException(); }
protected internal virtual void OnWorkspaceFailed(WorkspaceDiagnostic diagnostic) { var handlers = this.eventMap.GetEventHandlers<EventHandler<WorkspaceDiagnosticEventArgs>>(WorkspaceFailedEventName); if (handlers.Length > 0) { var args = new WorkspaceDiagnosticEventArgs(diagnostic); foreach (var handler in handlers) { handler(this, args); } } }
private static void WorkspaceFailed(object sender, WorkspaceDiagnosticEventArgs e) { var message = e.Diagnostic.Message; if (message.StartsWith("Could not find file") || message.StartsWith("Could not find a part of the path")) { return; } if (message.StartsWith("The imported project ")) { return; } if (message.Contains("because the file extension '.shproj'")) { return; } var project = ((Workspace)sender).CurrentSolution.Projects.FirstOrDefault(); if (project != null) { message = message + " Project: " + project.Name; } Log.Exception("Workspace failed: " + message); Log.Write(message, ConsoleColor.Red); }
private Task RaiseWorkspaceFailedEventAsync(WorkspaceDiagnostic diagnostic) { var handlers = this.eventMap.GetEventHandlers<EventHandler<WorkspaceDiagnosticEventArgs>>(WorkspaceFailedEventName); if (handlers != null) { return this.ScheduleTask(() => { var args = new WorkspaceDiagnosticEventArgs(diagnostic); foreach (var handler in handlers) { handler(this, args); } }, "Workspace.WorkspaceFailed"); } else { return SpecializedTasks.EmptyTask; } }
protected internal virtual void OnWorkspaceFailed(WorkspaceDiagnostic diagnostic) { var ev = _eventMap.GetEventHandlers<EventHandler<WorkspaceDiagnosticEventArgs>>(WorkspaceFailedEventName); if (ev.HasHandlers) { var args = new WorkspaceDiagnosticEventArgs(diagnostic); ev.RaiseEvent(handler => handler(this, args)); } }
private void _workspace_WorkspaceFailed(object sender, WorkspaceDiagnosticEventArgs e) { try { var logDirectory = System.Web.Hosting.HostingEnvironment.MapPath("/WorkspaceLogs/"); if (logDirectory == null) { // If we are not running within a web server, logDirectory will be null. // Whoever invoked this SolutionAnalyze will handle this issue. var wrapperException = new Exception(); wrapperException.Data["Diagnostic"] = e.Diagnostic; throw wrapperException; } if (!Directory.Exists(logDirectory)) Directory.CreateDirectory(logDirectory); var logPath = logDirectory + "log.txt"; using (var sw = new StreamWriter(logPath)) { sw.Write(e); } } catch { // All issues with logging are rethrown. throw; } }