dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.23k stars 1.35k forks source link

[Bug]: TerminalLogger "on" and "off" are not recognized, results in resource errors. #9150

Closed tbolon closed 1 year ago

tbolon commented 1 year ago

Issue Description

When using the TerminalLogger /tl argument, only the auto (or nothing) works. All other values (on or off) results in a resource error:

I suppose the difference in the resource name is because of #8915 and difference in version between dotnet and msbuild.

So there are two problems here:

Steps to Reproduce

dotnet new console -o ConsoleApp8
cd ConsoleApp8
msbuild -tl:on
dotnet build -tl:on

Expected Behavior

compilation succeed with terminallogger enabled.

Actual Behavior

> dotnet build /tl:on
MSBuild version 17.8.0-preview-23367-03+0ff2a83e9 for .NET
MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
Microsoft.Build.Framework.InternalErrorException: MSB0001: Internal MSBuild Error: Missing resource 'InvalidLiveLoggerValue'
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args)
   at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage, Object arg0)
   at Microsoft.Build.Shared.AssemblyResources.GetString(String name)
   at Microsoft.Build.Shared.ResourceUtilities.FormatResourceStringStripCodeAndKeyword(String& code, String& helpKeyword, String resourceName, Object[] args)
   at Microsoft.Build.Shared.ResourceUtilities.FormatResourceStringStripCodeAndKeyword(String resourceName, Object[] args)
   at Microsoft.Build.CommandLine.CommandLineSwitchException.Throw(String messageResourceName, String commandLineArg, String[] messageArgs)
   at Microsoft.Build.CommandLine.CommandLineSwitchException.Throw(String messageResourceName, String commandLineArg)
   at Microsoft.Build.CommandLine.MSBuildApp.ProcessLiveLoggerConfiguration(CommandLineSwitches commandLineSwitches)
   at Microsoft.Build.CommandLine.MSBuildApp.ProcessCommandLineSwitches(CommandLineSwitches switchesFromAutoResponseFile, CommandLineSwitches switchesNotFromAutoResponseFile, String& projectFile, String[]& targets, String& toolsVersion, Dictionary`2& globalProperties, ILogger[]& loggers, LoggerVerbosity& verbosity, LoggerVerbosity& originalVerbosity, List`1& distributedLoggerRecords, Int32& cpuCount, Boolean& enableNodeReuse, TextWriter& preprocessWriter, TextWriter& targetsWriter, Boolean& detailedSummary, ISet`1& warningsAsErrors, ISet`1& warningsNotAsErrors, ISet`1& warningsAsMessages, Boolean& enableRestore, Boolean& interactive, ProfilerLogger& profilerLogger, Boolean& enableProfiler, Dictionary`2& restoreProperties, ProjectIsolationMode& isolateProjects, GraphBuildOptions& graphBuild, String[]& inputResultsCaches, String& outputResultsCache, Boolean& lowPriority, Boolean& question, Boolean recursing, String commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
Unhandled exception: Microsoft.Build.Framework.InternalErrorException: MSB0001: Internal MSBuild Error: Missing resource 'InvalidLiveLoggerValue'
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args)
   at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage, Object arg0)
   at Microsoft.Build.Shared.AssemblyResources.GetString(String name)
   at Microsoft.Build.Shared.ResourceUtilities.FormatResourceStringStripCodeAndKeyword(String& code, String& helpKeyword, String resourceName, Object[] args)
   at Microsoft.Build.Shared.ResourceUtilities.FormatResourceStringStripCodeAndKeyword(String resourceName, Object[] args)
   at Microsoft.Build.CommandLine.CommandLineSwitchException.Throw(String messageResourceName, String commandLineArg, String[] messageArgs)
   at Microsoft.Build.CommandLine.CommandLineSwitchException.Throw(String messageResourceName, String commandLineArg)
   at Microsoft.Build.CommandLine.MSBuildApp.ProcessLiveLoggerConfiguration(CommandLineSwitches commandLineSwitches)
   at Microsoft.Build.CommandLine.MSBuildApp.ProcessCommandLineSwitches(CommandLineSwitches switchesFromAutoResponseFile, CommandLineSwitches switchesNotFromAutoResponseFile, String& projectFile, String[]& targets, String& toolsVersion, Dictionary`2& globalProperties, ILogger[]& loggers, LoggerVerbosity& verbosity, LoggerVerbosity& originalVerbosity, List`1& distributedLoggerRecords, Int32& cpuCount, Boolean& enableNodeReuse, TextWriter& preprocessWriter, TextWriter& targetsWriter, Boolean& detailedSummary, ISet`1& warningsAsErrors, ISet`1& warningsNotAsErrors, ISet`1& warningsAsMessages, Boolean& enableRestore, Boolean& interactive, ProfilerLogger& profilerLogger, Boolean& enableProfiler, Dictionary`2& restoreProperties, ProjectIsolationMode& isolateProjects, GraphBuildOptions& graphBuild, String[]& inputResultsCaches, String& outputResultsCache, Boolean& lowPriority, Boolean& question, Boolean recursing, String commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Main(String[] args)
   at Microsoft.DotNet.Cli.Utils.MSBuildForwardingAppWithoutLogging.ExecuteInProc(String[] arguments) 
> msbuild /tl:on
MSBuild version 17.8.0-preview-23376-06+f413f5497 for .NET Framework
MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
Microsoft.Build.Framework.InternalErrorException: MSB0001: Internal MSBuild Error: Missing resource 'InvalidTerminalLoggerValue'
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args)
   at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage, Object arg0)
   at Microsoft.Build.Shared.AssemblyResources.GetString(String name)
   at Microsoft.Build.Shared.ResourceUtilities.FormatResourceStringStripCodeAndKeyword(String& code, String& helpKeyword, String resourceName, Object[] args)
   at Microsoft.Build.CommandLine.CommandLineSwitchException.Throw(String messageResourceName, String commandLineArg, String[] messageArgs)
   at Microsoft.Build.CommandLine.MSBuildApp.ProcessTerminalLoggerConfiguration(CommandLineSwitches commandLineSwitches)
   at Microsoft.Build.CommandLine.MSBuildApp.ProcessCommandLineSwitches(CommandLineSwitches switchesFromAutoResponseFile, CommandLineSwitches switchesNotFromAutoResponseFile, String& projectFile, String[]& targets, String& toolsVersion, Dictionary`2& globalProperties, ILogger[]& loggers, LoggerVerbosity& verbosity, LoggerVerbosity& originalVerbosity, List`1& distributedLoggerRecords, Boolean& needToValidateProject, String& schemaFile, Int32& cpuCount, Boolean& enableNodeReuse, TextWriter& preprocessWriter, TextWriter& targetsWriter, Boolean& detailedSummary, ISet`1& warningsAsErrors, ISet`1& warningsNotAsErrors, ISet`1& warningsAsMessages, Boolean& enableRestore, Boolean& interactive, ProfilerLogger& profilerLogger, Boolean& enableProfiler, Dictionary`2& restoreProperties, ProjectIsolationMode& isolateProjects, GraphBuildOptions& graphBuild, String[]& inputResultsCaches, String& outputResultsCache, Boolean& lowPriority, Boolean& question, Boolean recursing, String commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine)

Unhandled Exception: Microsoft.Build.Framework.InternalErrorException: MSB0001: Internal MSBuild Error: Missing resource 'InvalidTerminalLoggerValue'
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args)
   at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage, Object arg0)
   at Microsoft.Build.Shared.AssemblyResources.GetString(String name)
   at Microsoft.Build.Shared.ResourceUtilities.FormatResourceStringStripCodeAndKeyword(String& code, String& helpKeyword, String resourceName, Object[] args)
   at Microsoft.Build.CommandLine.CommandLineSwitchException.Throw(String messageResourceName, String commandLineArg, String[] messageArgs)
   at Microsoft.Build.CommandLine.MSBuildApp.ProcessTerminalLoggerConfiguration(CommandLineSwitches commandLineSwitches)
   at Microsoft.Build.CommandLine.MSBuildApp.ProcessCommandLineSwitches(CommandLineSwitches switchesFromAutoResponseFile, CommandLineSwitches switchesNotFromAutoResponseFile, String& projectFile, String[]& targets, String& toolsVersion, Dictionary`2& globalProperties, ILogger[]& loggers, LoggerVerbosity& verbosity, LoggerVerbosity& originalVerbosity, List`1& distributedLoggerRecords, Boolean& needToValidateProject, String& schemaFile, Int32& cpuCount, Boolean& enableNodeReuse, TextWriter& preprocessWriter, TextWriter& targetsWriter, Boolean& detailedSummary, ISet`1& warningsAsErrors, ISet`1& warningsNotAsErrors, ISet`1& warningsAsMessages, Boolean& enableRestore, Boolean& interactive, ProfilerLogger& profilerLogger, Boolean& enableProfiler, Dictionary`2& restoreProperties, ProjectIsolationMode& isolateProjects, GraphBuildOptions& graphBuild, String[]& inputResultsCaches, String& outputResultsCache, Boolean& lowPriority, Boolean& question, Boolean recursing, String commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Main()

Analysis

Perhaps related to #9119 ?

Versions & Configurations

> msbuild -version
MSBuild version 17.8.0-preview-23376-06+f413f5497 for .NET Framework
17.8.0.37606
> dotnet --version
8.0.100-preview.7.23376.3
tbolon commented 1 year ago

All of these seems related to #9063 and other recents change, documentaiton is marked as TODO in this issue.

You can close this issue if it's a duplicate.

AR-May commented 1 year ago

@JaynieBai Let's try to repro this on the latest main and check that documentation is accurate.

baronfel commented 1 year ago

I'd expect that as of Romans SDK enablement changes that off/on are accepted here - they aren't available publicly until RC1 builds are released, though.

tbolon commented 1 year ago

FYI, the dotnet build documentation is here: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build#options

The option is described as --tl [auto|on|off] and was the initial reason I created this issue. All these changes are really recent, so I suppose this will be fixed on time for RC1.

JaynieBai commented 1 year ago

@JaynieBai Let's try to repro this on the latest main and check that documentation is accurate.

Tested with latest main build. The error is gone. image

image

JaynieBai commented 1 year ago

@AR-May This doesn't repro in latest main. Should we close it?

AR-May commented 1 year ago

Seems like this issue is already fixed. The fix would be available when .NET 8 RC1 is released.