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

Commit 6b2e91d

Browse files
authored
Merge pull request #9019 from mono/error-counter
[Core] Add counter information for project build errors
2 parents 8574adc + 03833e0 commit 6b2e91d

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,5 +1890,21 @@ 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 (errorCode == null)
1899+
return;
1900+
1901+
if (errors == null) {
1902+
errors = new Dictionary<string, int> ();
1903+
SetProperty (errors, "Errors");
1904+
}
1905+
1906+
errors.TryGetValue (errorCode, out int value);
1907+
errors [errorCode] = value + 1;
1908+
}
18931909
}
18941910
}

0 commit comments

Comments
 (0)