From 81e5071276d38477404e86df4565f05a95b984af Mon Sep 17 00:00:00 2001 From: NikolayPianikov Date: Wed, 4 Aug 2021 17:58:37 +0300 Subject: [PATCH] TW-72330 Sometimes build log skips errors from .NET runner --- TeamCity.MSBuild.Logger/DefaultConsole.cs | 6 +++++- TeamCity.MSBuild.Logger/Properties/launchSettings.json | 10 ---------- 2 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 TeamCity.MSBuild.Logger/Properties/launchSettings.json diff --git a/TeamCity.MSBuild.Logger/DefaultConsole.cs b/TeamCity.MSBuild.Logger/DefaultConsole.cs index e8dd179..34d496e 100644 --- a/TeamCity.MSBuild.Logger/DefaultConsole.cs +++ b/TeamCity.MSBuild.Logger/DefaultConsole.cs @@ -1,6 +1,7 @@ namespace TeamCity.MSBuild.Logger { using System; + using System.IO; using System.Threading; using JetBrains.Annotations; @@ -8,12 +9,15 @@ internal class DefaultConsole : IConsole { [NotNull] private readonly IDiagnostics _diagnostics; + [NotNull] private readonly TextWriter _out; // ReSharper disable once IdentifierTypo private int _reentrancy; public DefaultConsole([NotNull] IDiagnostics diagnostics) { _diagnostics = diagnostics ?? throw new ArgumentNullException(nameof(diagnostics)); + // https://youtrack.jetbrains.com/issue/TW-72330 + _out = Console.Out; } public void Write(string text) @@ -26,7 +30,7 @@ public void Write(string text) _diagnostics.Send(() => $"[{reentrancy} +] Write({text.Trim()})"); try { - Console.Write(text); + _out.Write(text); } finally { diff --git a/TeamCity.MSBuild.Logger/Properties/launchSettings.json b/TeamCity.MSBuild.Logger/Properties/launchSettings.json deleted file mode 100644 index 782e6f4..0000000 --- a/TeamCity.MSBuild.Logger/Properties/launchSettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "profiles": { - "TeamCity.MSBuild.Logger": { - "commandName": "Executable", - "executablePath": "C:\\Program Files\\dotnet\\dotnet.exe", - "commandLineArgs": "build C:\\Projects\\TeamCity\\TeamCity.MSBuild.Logger\\IntegrationTests\\Console\\Console.csproj --verbosity minimal /noconsolelogger /l:TeamCity.MSBuild.Logger.TeamCityMSBuildLogger,TeamCity.MSBuild.Logger\\bin\\Debug\\net452\\TeamCity.MSBuild.Logger.dll;teamcity;DEBUG", - "workingDirectory": "C:\\Projects\\TeamCity\\TeamCity.MSBuild.Logger" - } - } -} \ No newline at end of file