예제 #1
0
        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));
            }
        }
예제 #2
0
        private void OnWorkspaceFailed(object sender, WorkspaceDiagnosticEventArgs e)
        {
            InvokeBelowInputPriority(() =>
            {
                var outputPane = this.OutputPane;
                if (outputPane == null)
                {
                    return;
                }

                outputPane.OutputString(e.Diagnostic.ToString() + Environment.NewLine);
            });
        }
예제 #3
0
        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);
                }
            }
        }
예제 #4
0
        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();
 }
예제 #6
0
 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);
         }
     }
 }
예제 #7
0
        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);
        }
예제 #8
0
 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));
     }
 }
예제 #10
0
        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;
            }
        }