Beispiel #1
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lv.SelectedIndices.Count <= 0)
            {
                return;
            }
            int          i = lv.SelectedIndices[0];
            ListViewItem v = lv.Items[i];

            if (ef == null)
            {
                return;
            }

            if (v.Tag == null)
            {
                return;
            }
            if (v.Tag.GetType() == typeof(Microsoft.Build.Framework.BuildErrorEventArgs))
            {
                Microsoft.Build.Framework.BuildErrorEventArgs b = v.Tag as Microsoft.Build.Framework.BuildErrorEventArgs;

                string project = b.ProjectFile;
                string file    = Path.GetDirectoryName(b.ProjectFile) + "\\" + b.File;
                int    c       = b.LineNumber;
                int    p       = b.ColumnNumber;
                int    es      = b.EndLineNumber;
                int    ep      = b.EndColumnNumber;

                ef.OpenFileLine(file, c.ToString(), p);
            }
            else if (v.Tag.GetType() == typeof(Microsoft.Build.Framework.BuildWarningEventArgs))
            {
                Microsoft.Build.Framework.BuildWarningEventArgs b = v.Tag as Microsoft.Build.Framework.BuildWarningEventArgs;

                string project = b.ProjectFile;
                string file    = Path.GetDirectoryName(b.ProjectFile) + "\\" + b.File;
                int    c       = b.LineNumber;
                int    p       = b.ColumnNumber;
                int    es      = b.EndLineNumber;
                int    ep      = b.EndColumnNumber;

                ef.OpenFileLine(file, c.ToString(), p);
            }
            else if (v.Tag.GetType() == typeof(ViolationEventArgs))
            {
                ViolationEventArgs b = v.Tag as ViolationEventArgs;

                string project = b.SourceCode.Path;
                string file    = Path.GetDirectoryName(project) + "\\" + b.SourceCode.Name;
                int    c       = b.LineNumber;
                int    p       = b.LineNumber;

                //ef.BeginInvoke(new Action(() => { ef.OpenFileLineHighlight(file, c.ToString(), p); }));

                AsyncCallback callBack = new AsyncCallback(ProcessInformation);
                GotoWarning   g        = Warning;
                g.BeginInvoke(file, c.ToString(), p, callBack, "null");
            }
        }
        void eventSource_WarningRaised(object sender, Microsoft.Build.Framework.BuildWarningEventArgs e)
        {
            string dir = System.IO.Directory.GetCurrentDirectory();

            string line = String.Format("{0}({1},{2}): warning {3}: {4} ",
                                        System.IO.Path.Combine(dir, e.File), e.LineNumber, e.ColumnNumber, e.Code, e.Message);

            Console.WriteLine(line);
        }
Beispiel #3
0
        private void EventSource_WarningRaised(object sender, Microsoft.Build.Framework.BuildWarningEventArgs e)
        {
            var sb = new StringBuilder();

            sb.Append($"Warning {e.Code}");
            sb.AppendLine(e.Message);
            sb.AppendLine($"Project: {e.ProjectFile}");
            sb.AppendLine($"Line {e.LineNumber} Column {e.ColumnNumber} in file {e.File}");
            sb.Append($"{new string('*', 50)}");
            Logger.Warning(sb.ToString());
        }
Beispiel #4
0
 private void OnWarning(object sender, Microsoft.Build.Framework.BuildWarningEventArgs args)
 {
     _logger.LogWarning(args.Message);
     _diagnostics.Add(new MSBuildDiagnosticsMessage()
     {
         LogLevel    = "Warning",
         FileName    = args.File,
         Text        = args.Message,
         StartLine   = args.LineNumber,
         StartColumn = args.ColumnNumber,
         EndLine     = args.EndLineNumber,
         EndColumn   = args.EndColumnNumber
     });
 }
Beispiel #5
0
 private void OnWarningRaised(object sender, MSB.Framework.BuildWarningEventArgs e)
 {
     RoslynDebug.AssertNotNull(_projectFilePath);
     _log?.Add(
         new MSBuildDiagnosticLogItem(
             WorkspaceDiagnosticKind.Warning,
             _projectFilePath,
             e.Message,
             e.File,
             e.LineNumber,
             e.ColumnNumber
             )
         );
 }
Beispiel #6
0
 public virtual string FormatWarningEvent(Microsoft.Build.Framework.BuildWarningEventArgs args)
 {
     throw null;
 }
 private void eventSource_WarningRaised(object sender, Microsoft.Build.Framework.BuildWarningEventArgs e)
 {
     OutputString(EventArgsFormatter.FormatEventMessage(e, false, true));
 }
Beispiel #8
0
 public void WarningHandler(object sender, Microsoft.Build.Framework.BuildWarningEventArgs e)
 {
 }
 private void OnWarning(object sender, Microsoft.Build.Framework.BuildWarningEventArgs args)
 {
     _logger.LogWarning(args.Message);
     _diagnostics.Add(MSBuildDiagnostic.CreateFrom(args));
 }
Beispiel #10
0
 void eventSource_WarningRaised(object sender, Microsoft.Build.Framework.BuildWarningEventArgs e)
 {
     Console.ForegroundColor = ConsoleColor.DarkYellow;
     Console.WriteLine(e.Message);
     Console.ResetColor();
 }
 public static MSBuildDiagnostic CreateFrom(Microsoft.Build.Framework.BuildWarningEventArgs args)
 {
     return(new(MSBuildDiagnosticSeverity.Error,
                args.Message, args.File, args.ProjectFile, args.Subcategory, args.Code,
                args.LineNumber, args.ColumnNumber, args.EndLineNumber, args.EndColumnNumber));
 }
Beispiel #12
0
        private void OnWarning(object sender, Microsoft.Build.Framework.BuildWarningEventArgs args)
        {
            _logger.LogWarning(args.Message);

            AddDiagnostic("Warning", args.File, args.Message, args.LineNumber, args.ColumnNumber, args.EndLineNumber, args.EndColumnNumber);
        }
Beispiel #13
0
        private void Dg_SelectionChanged(object sender, EventArgs e)
        {
            if (dg.SelectedRows.Count <= 0)
            {
                return;
            }
            int i = dg.SelectedRows[0].Index;

            DataGridViewRow v = dg.Rows[i];

            if (ef == null)
            {
                return;
            }

            if (v.Tag == null)
            {
                return;
            }
            if (v.Tag.GetType() == typeof(Microsoft.Build.Framework.BuildErrorEventArgs))
            {
                Microsoft.Build.Framework.BuildErrorEventArgs b = v.Tag as Microsoft.Build.Framework.BuildErrorEventArgs;

                string project = b.ProjectFile;
                string file    = Path.GetDirectoryName(b.ProjectFile) + "\\" + b.File;
                int    c       = b.LineNumber;
                int    p       = b.ColumnNumber;
                int    es      = b.EndLineNumber;
                int    ep      = b.EndColumnNumber;

                AsyncCallback     callBack = new AsyncCallback(ProcessInformation);
                workerDisplayLine wde      = DisplayLine;
                wde.BeginInvoke(file, c, p, 100, callBack, "null");

                // ef.OpenFileLine(file, c.ToString(), p);
            }
            else if (v.Tag.GetType() == typeof(Microsoft.Build.Framework.BuildWarningEventArgs))
            {
                Microsoft.Build.Framework.BuildWarningEventArgs b = v.Tag as Microsoft.Build.Framework.BuildWarningEventArgs;

                string project = b.ProjectFile;
                string file    = Path.GetDirectoryName(b.ProjectFile) + "\\" + b.File;
                int    c       = b.LineNumber;
                int    p       = b.ColumnNumber;
                int    es      = b.EndLineNumber;
                int    ep      = b.EndColumnNumber;

                AsyncCallback     callBack = new AsyncCallback(ProcessInformation);
                workerDisplayLine wde      = DisplayLine;
                wde.BeginInvoke(file, c, p, 100, callBack, "null");

                //ef.OpenFileLine(file, c.ToString(), p);
            }
            else //if (v.Tag.GetType() == typeof(Diagnostic))
            {
                Diagnostic b = v.Tag as Diagnostic;

                if (b != null)
                {
                    //string project = b.vp.FileName;
                    if (b.Location == Microsoft.CodeAnalysis.Location.None)
                    {
                        return;
                    }
                    if (b.Location.SourceTree == null)
                    {
                        return;
                    }
                    string file = b.Location.SourceTree.FilePath;

                    Microsoft.CodeAnalysis.FileLinePositionSpan c = b.Location.GetLineSpan();
                    int ps = c.StartLinePosition.Line;
                    int cs = 0;
                    int es = c.StartLinePosition.Character;

                    int start  = b.Location.SourceSpan.Start;
                    int length = b.Location.SourceSpan.Length;

                    AsyncCallback     callBack = new AsyncCallback(ProcessInformation);
                    workerDisplayLine wde      = DisplayLine;
                    wde.BeginInvoke(file, start, length, 100, callBack, "null");

                    //ef.OpenFileLine(file, c.ToString(), p);
                }
            }
        }