Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit ff6be83

Browse files
committed
[Core] Add counter information for project build errors
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/978115
1 parent e0ac3c6 commit ff6be83

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,11 +1607,17 @@ void AddRunMSBuildTargetTimerMetadata (
16071607

16081608
metadata.FirstBuild = IsFirstBuild;
16091609

1610-
bool success = false;
1610+
bool success = true;
16111611
bool cancelled = false;
16121612

16131613
if (result != null) {
1614-
success = !result.Errors.Any (error => !error.IsWarning);
1614+
foreach (var error in result.Errors) {
1615+
bool isError = !error.IsWarning;
1616+
if (isError) {
1617+
success = false;
1618+
metadata.RegisterError (error.Code);
1619+
}
1620+
}
16151621

16161622
if (!success) {
16171623
cancelled = result.Errors [0].Message == "Build cancelled";

main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,5 +1890,18 @@ public bool Cancelled {
18901890
get => GetProperty<bool> ();
18911891
set => SetProperty (value);
18921892
}
1893+
1894+
Dictionary<string, int> errors;
1895+
1896+
public void RegisterError(string errorCode)
1897+
{
1898+
if (errors == null) {
1899+
errors = new Dictionary<string, int> ();
1900+
SetProperty (errors, "Errors");
1901+
}
1902+
1903+
errors.TryGetValue (errorCode, out int value);
1904+
errors [errorCode] = value + 1;
1905+
}
18931906
}
18941907
}

0 commit comments

Comments
 (0)