dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.05k stars 4.04k forks source link

csc: InvalidOperationException from TaskLoggingHelper.FormatResourceString() during dotnet-build #46772

Open am11 opened 4 years ago

am11 commented 4 years ago

Using dotnet-sdk v5.0.100-rc.1.20407.13, during the execution of dotnet build command, the Csc task from Roslyn/Microsoft.CSharp.Core.targets (file from this repo) fails with the following stack:

/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/Microsoft.CSharp.Core.targets(70,5): error MSB4018: The "Csc" task failed unexpectedly. [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/Microsoft.CSharp.Core.targets(70,5): error MSB4018: System.InvalidOperationException: The "Csc" task has not registered its resources. In order to use the "TaskLoggingHelper.FormatResourceString()" method this task needs to register its resources either during construction, or via the "TaskResources" property. [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/Microsoft.CSharp.Core.targets(70,5): error MSB4018:    at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/Microsoft.CSharp.Core.targets(70,5): error MSB4018:    at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation(Boolean condition, String resourceName, Object arg0) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/Microsoft.CSharp.Core.targets(70,5): error MSB4018:    at Microsoft.Build.Utilities.TaskLoggingHelper.FormatResourceString(String resourceName, Object[] args) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/Microsoft.CSharp.Core.targets(70,5): error MSB4018:    at Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorWithCodeFromResources(String messageResourceName, Object[] messageArgs) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/Microsoft.CSharp.Core.targets(70,5): error MSB4018:    at Microsoft.CodeAnalysis.BuildTasks.ManagedCompiler.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/Microsoft.CSharp.Core.targets(70,5): error MSB4018:    at Microsoft.Build.Utilities.ToolTask.Execute() [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/Microsoft.CSharp.Core.targets(70,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/Microsoft.CSharp.Core.targets(70,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
The csc command looks like this: (click to expand) > /root/.dotnet/dotnet exec "/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Roslyn/bincore/csc.dll" /noconfig /unsafe- /checked- /nowarn:1701,1702,1701,1702 /fullpaths /nostdlib+ /errorreport:prompt /warn:5 /define:TRACE;DEBUG;NET;NET5_0;NETCOREAPP;NETCOREAPP3_1 /highentropyva+ /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/Microsoft.CSharp.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/Microsoft.VisualBasic.Core.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/Microsoft.VisualBasic.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/Microsoft.Win32.Primitives.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/mscorlib.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/netstandard.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.AppContext.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Buffers.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Collections.Concurrent.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Collections.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Collections.Immutable.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Collections.NonGeneric.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Collections.Specialized.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.ComponentModel.Annotations.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.ComponentModel.DataAnnotations.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.ComponentModel.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.ComponentModel.EventBasedAsync.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.ComponentModel.Primitives.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.ComponentModel.TypeConverter.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Configuration.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Console.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Core.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Data.Common.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Data.DataSetExtensions.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Data.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Diagnostics.Contracts.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Diagnostics.Debug.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Diagnostics.DiagnosticSource.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Diagnostics.FileVersionInfo.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Diagnostics.Process.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Diagnostics.StackTrace.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Diagnostics.TextWriterTraceListener.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Diagnostics.Tools.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Diagnostics.TraceSource.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Diagnostics.Tracing.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Drawing.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Drawing.Primitives.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Dynamic.Runtime.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Formats.Asn1.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Globalization.Calendars.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Globalization.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Globalization.Extensions.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.Compression.Brotli.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.Compression.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.Compression.FileSystem.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.Compression.ZipFile.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.FileSystem.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.FileSystem.DriveInfo.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.FileSystem.Primitives.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.FileSystem.Watcher.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.IsolatedStorage.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.MemoryMappedFiles.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.Pipelines.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.Pipes.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.IO.UnmanagedMemoryStream.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Linq.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Linq.Expressions.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Linq.Parallel.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Linq.Queryable.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Memory.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.Connections.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.Http.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.Http.Json.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.HttpListener.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.Mail.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.NameResolution.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.NetworkInformation.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.Ping.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.Primitives.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.Requests.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.Security.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.ServicePoint.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.Sockets.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.WebClient.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.WebHeaderCollection.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.WebProxy.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.WebSockets.Client.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Net.WebSockets.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Numerics.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Numerics.Vectors.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.ObjectModel.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Reflection.DispatchProxy.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Reflection.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Reflection.Emit.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Reflection.Emit.ILGeneration.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Reflection.Emit.Lightweight.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Reflection.Extensions.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Reflection.Metadata.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Reflection.Primitives.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Reflection.TypeExtensions.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Resources.Reader.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Resources.ResourceManager.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Resources.Writer.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.CompilerServices.Unsafe.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.CompilerServices.VisualC.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.Extensions.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.Handles.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.InteropServices.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.InteropServices.JavaScript.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.InteropServices.RuntimeInformation.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.Intrinsics.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.Loader.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.Numerics.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.Serialization.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.Serialization.Formatters.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.Serialization.Json.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.Serialization.Primitives.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Runtime.Serialization.Xml.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Security.Claims.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Security.Cryptography.Algorithms.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Security.Cryptography.Csp.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Security.Cryptography.Encoding.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Security.Cryptography.Primitives.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Security.Cryptography.X509Certificates.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Security.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Security.Principal.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Security.SecureString.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.ServiceModel.Web.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.ServiceProcess.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Text.Encoding.CodePages.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Text.Encoding.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Text.Encoding.Extensions.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Text.Encodings.Web.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Text.Json.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Text.RegularExpressions.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Threading.Channels.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Threading.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Threading.Overlapped.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Threading.Tasks.Dataflow.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Threading.Tasks.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Threading.Tasks.Extensions.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Threading.Tasks.Parallel.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Threading.Thread.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Threading.ThreadPool.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Threading.Timer.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Transactions.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Transactions.Local.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.ValueTuple.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Web.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Web.HttpUtility.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Windows.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Xml.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Xml.Linq.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Xml.ReaderWriter.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Xml.Serialization.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Xml.XDocument.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Xml.XmlDocument.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Xml.XmlSerializer.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Xml.XPath.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/System.Xml.XPath.XDocument.dll /reference:/root/.dotnet/packs/Microsoft.NETCore.App.Ref/5.0.0-rc.1.20404.16/ref/net5.0/WindowsBase.dll /debug+ /debug:portable /filealign:512 /optimize- /out:obj/Debug/net5.0/hwapp.dll /refout:obj/Debug/net5.0/ref/hwapp.dll /target:exe /warnaserror- /utf8output /deterministic+ /langversion:9.0 /analyzerconfig:obj/Debug/net5.0/hwapp.GeneratedMSBuildEditorConfig.editorconfig /analyzer:/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Sdks/Microsoft.NET.Sdk/targets/../analyzers/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll /analyzer:/root/.dotnet/sdk/5.0.100-rc.1.20407.13/Sdks/Microsoft.NET.Sdk/targets/../analyzers/Microsoft.CodeAnalysis.NetAnalyzers.dll Program.cs "obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs" obj/Debug/net5.0/hwapp.AssemblyInfo.cs /warnaserror+:NU1605

dotnet-build /v:diag logs: https://api.cirrus-ci.com/v1/task/5495860022738944/logs/emulate%20dotnet.log.

kant2002 commented 4 years ago

Reproduces in RC2 too.

kant2002 commented 4 years ago

Seems to be related to https://github.com/dotnet/sdk/issues/14236

daniels7 commented 3 years ago

We get the same error on a Mac Mini BuildHost with Big Sur and the newest dotnet 5 sdk

If the build is restarted several times it mostly finishes successfully then

vijayganeshpk commented 3 years ago

image

dotnet --info

.NET SDK (reflecting any global.json):
 Version:   5.0.101
 Commit:    d05174dc5a

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  11.0
 OS Platform: Darwin
 RID:         osx.11.0-x64
 Base Path:   /usr/local/share/dotnet/sdk/5.0.101/

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

.NET SDKs installed:
  3.1.402 [/usr/local/share/dotnet/sdk]
  5.0.100-rc.2.20479.15 [/usr/local/share/dotnet/sdk]
  5.0.100 [/usr/local/share/dotnet/sdk]
  5.0.101 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0-rc.2.20475.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Two issues, the same error in the original topic appears at random and retrying to rebuild succeeds (sometimes after dotnet clean). Other times instead of displaying the actual code error a csc error comes up with loads of stack trace and it is quite hard to debug (thankfully vs code points out potential errors and helps in those situations).

rdasan commented 3 years ago

This issue is happening to me as well and as @vijayganeshpk pointed out, it appears at random and rebuild seems to fix it. We are using CircleCI for CI and the issue seems to happen randomly there. A rerun of the build usually fixes it. We recently upgraded to .Net 5 from .Net Core 3.1 and this issue started happening after that.

/usr/share/dotnet/sdk/5.0.101/Roslyn/Microsoft.CSharp.Core.targets(71,5): error MSB4018: System.InvalidOperationException: The "Csc" task has not registered its resources. In order to use the "TaskLoggingHelper.FormatResourceString()" method this task needs to register its resources either during construction, or via the "TaskResources" property. [/root/project/src/xxxxx.csproj]
/usr/share/dotnet/sdk/5.0.101/Roslyn/Microsoft.CSharp.Core.targets(71,5): error MSB4018:    at Microsoft.Build.Shared.ErrorUtilities

I see that the related issue is closed https://github.com/dotnet/sdk/issues/14236

Wonder why that is closed

tmds commented 3 years ago

The exception seems msbuild related. /cc @rainersigwald @Forgind

The "Csc" task failed unexpectedly. [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
System.InvalidOperationException: The "Csc" task has not registered its resources. In order to use the "TaskLoggingHelper.FormatResourceString()" method this task needs to register its resources either during construction, or via the "TaskResources" property. [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
   at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation(Boolean condition, String resourceName, Object arg0) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
   at Microsoft.Build.Utilities.TaskLoggingHelper.FormatResourceString(String resourceName, Object[] args) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
   at Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorWithCodeFromResources(String messageResourceName, Object[] messageArgs) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
   at Microsoft.CodeAnalysis.BuildTasks.ManagedCompiler.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
   at Microsoft.Build.Utilities.ToolTask.Execute() [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/tmp/cirrus-ci-build/hwapp/hwapp.csproj]
rainersigwald commented 3 years ago

Since the task does register its resources in its ctor,

https://github.com/dotnet/roslyn/blob/1223006dad529b84b0a9d81c4dcee239fe87b772/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs#L32-L34

I'd say this is possibly an MSBuild problem, or possibly ErrorString.ResourceManager is null when assigned somehow?

Does anyone have a solid local repro of this? Even if it doesn't happen every time? I think catching it in the debugger or using instrumented binaries might be a good path forward.

AKhotoolev commented 3 years ago

Since the task does register its resources in its ctor,

https://github.com/dotnet/roslyn/blob/1223006dad529b84b0a9d81c4dcee239fe87b772/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs#L32-L34

I'd say this is possibly an MSBuild problem, or possibly ErrorString.ResourceManager is null when assigned somehow?

Does anyone have a solid local repro of this? Even if it doesn't happen every time? I think catching it in the debugger or using instrumented binaries might be a good path forward.

Hi, i faced with same error under gitlab pipeline afer using microsoft.net.compilers

Actual log message from gitlab is here:

/root/.nuget/packages/microsoft.net.compilers/3.8.0/tools/Microsoft.CSharp.Core.targets(71,5): error MSB4018: System.InvalidOperationException: The "Csc" task has not registered its resources. In order to use the "TaskLoggingHelper.FormatResourceString()" method this task needs to register its resources either during construction, or via the "TaskResources" property. [/app/server/SharedLogic.PublicContract/SharedLogic.PublicContract.csproj]
/root/.nuget/packages/microsoft.net.compilers/3.8.0/tools/Microsoft.CSharp.Core.targets(71,5): error MSB4018:    at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args) [/app/server/SharedLogic.PublicContract/SharedLogic.PublicContract.csproj]
/root/.nuget/packages/microsoft.net.compilers/3.8.0/tools/Microsoft.CSharp.Core.targets(71,5): error MSB4018:    at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation(Boolean condition, String resourceName, Object arg0) [/app/server/SharedLogic.PublicContract/SharedLogic.PublicContract.csproj]
/root/.nuget/packages/microsoft.net.compilers/3.8.0/tools/Microsoft.CSharp.Core.targets(71,5): error MSB4018:    at Microsoft.Build.Utilities.TaskLoggingHelper.FormatResourceString(String resourceName, Object[] args) [/app/server/SharedLogic.PublicContract/SharedLogic.PublicContract.csproj]
/root/.nuget/packages/microsoft.net.compilers/3.8.0/tools/Microsoft.CSharp.Core.targets(71,5): error MSB4018:    at Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorWithCodeFromResources(String messageResourceName, Object[] messageArgs) [/app/server/SharedLogic.PublicContract/SharedLogic.PublicContract.csproj]
/root/.nuget/packages/microsoft.net.compilers/3.8.0/tools/Microsoft.CSharp.Core.targets(71,5): error MSB4018:    at Microsoft.CodeAnalysis.BuildTasks.ManagedCompiler.ExecuteTool(String pathToTool, String responseFileCommands, String commandLineCommands) [/app/server/SharedLogic.PublicContract/SharedLogic.PublicContract.csproj]
/root/.nuget/packages/microsoft.net.compilers/3.8.0/tools/Microsoft.CSharp.Core.targets(71,5): error MSB4018:    at Microsoft.Build.Utilities.ToolTask.Execute() [/app/server/SharedLogic.PublicContract/SharedLogic.PublicContract.csproj]
/root/.nuget/packages/microsoft.net.compilers/3.8.0/tools/Microsoft.CSharp.Core.targets(71,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/app/server/SharedLogic.PublicContract/SharedLogic.PublicContract.csproj]
/root/.nuget/packages/microsoft.net.compilers/3.8.0/tools/Microsoft.CSharp.Core.targets(71,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost 

I noticed, that same code will be succesfully compiled under windows. But under WSL2(Ubuntu 18.4) it fails with error message (CSC : error CS2011: Can't access file "C:\tmp/tmp22044f8d25724dd08c672dd620af9f1d.rsp"). Actually, I think that it is the original problem (which is masked by broken resource registration).

I created sample code to reproduce it. https://github.com/AKhotoolev/msbuild_crash

It works on Windows 10, but fails on WSL2(ubuntu 18.4) and Docker image (alpine)

on my windows: image

in WSL: image

lostmsu commented 3 years ago

Same error in Python.NET with an explicit reference to Microsoft.Net.Compilers (both released and 3.9.0-3.final) on Mac in GitHub Workflow. Works fine on Windows and Linux.

https://github.com/losttech/pythonnet/runs/1750905995?check_suite_focus=true#step:7:33836

It might be important, that Xamarin is installed.

lostmsu commented 3 years ago

The issue appears to be solved by replacing a reference to Microsoft.Net.Compilers with a reference to Microsoft.Net.Compilers.Toolset.

pdonovan commented 3 years ago

We are seeing this error in attempting to update from .Net Core 3.1 to .Net 5. It happens on Windows 10 and on macOS Big Sur.

It is triggered by having a PreBuild event in the project file:

<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
    <RemoveDir Directories="$(TargetDir)" />
  </Target>

If I remove that, the error does not occur. In reality we also have a PostBuildEvent, that causes the same problem. So by removing them we can build the project, but not the solution (the copying is required as part of the full solution build).

edit: This works, so it's the RemoveDir that causes the error rather than the Target itself:

  <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
    <Message Text="Deleting $(TargetDir)" Importance="high" />
  </Target>
daniels7 commented 3 years ago

Is there any chance that this issue will be ever addressed? It's quite a dealbreaker if you have non-Windows machines in your CI pipelines. It should be handled with high priority

clickonchris commented 3 years ago

I found this thread via google search with the same stack trace. I'm running a mac with Big Sur. In my case the culprit was ESET real-time file system protection. After disabling the real-time file system protection this error disappeared.

reynoldsa commented 3 years ago

I can also confirm that this triggers with defender atp for mac active on my M1 machine. The only workaround is pausing real-time protection; even adding an exception for the build directory doesn't fix it.

iainb123 commented 3 years ago

I had the exact same issue until I disabled BitDefender (thanks to @clickonchris - without his comment it wouldn't have occurred to me to try this).

daniels7 commented 3 years ago

For me it worked to disable Eset Real Time File Protection as well. Due to the problem appearing with so many products I still think that this is a problem on the microsoft side which should be addressed asap, since it's no solution to prevent AntiVirus forever on Build Machines

lambdageek commented 3 years ago

Might be related to https://github.com/dotnet/runtime/issues/48663 and https://github.com/dotnet/runtime/issues/47584

Edo90 commented 3 years ago

Im having the same issue, System.InvalidOperationException: The "Csc" task has not registered its resources. In order to use the "TaskLoggingHelper.FormatResourceString()" method this task needs to register its resources either during construction, or via the "TaskResources" property.

Running DotNet 5.0.201 on Windows 10

pankajsparashar commented 3 years ago

I am trying to compile (dotnet build) my .net core 3.1 Web API Project . I tried in VS2019 , VS Code wirh .net core 3.1 . Getting same error System.InvalidOperationException: The "Csc" task has not registered its resources. In order to use the "TaskLoggingHelper.FormatResourceString()" method this task needs to register its resources either during construction, or via the "TaskResources" property.

Does anybody got luck to solve it ?

pdonovan commented 3 years ago

My workaround was to remove the targets in the .csproj file that were causing the error. The main one was a RemoveDir target - it was redundant as our build agents start from a fresh file structure each time.

NickRimmer commented 3 years ago

I faced this problem with the same error message and spent about hour... to understand that I had not enough space on disk )=

Saibamen commented 3 years ago

This same for me in Azure DevOps (running on Azure Pipelines pool (windows-2019)) with building Docker image (I'm using mcr.microsoft.com/dotnet/framework/sdk:4.8) Cmd: RUN msbuild WebAPI.csproj /p:Configuration=Release

This is strange, because I can build my Docker image without any problem on my local machine

Saibamen commented 3 years ago

Working solution for Azure DevOps release pipeline (Docker build in Windows containers):

USER ContainerAdministrator

# build app
SHELL ["cmd", "/S", "/C"]
RUN msbuild MyWebAPI.csproj /p:Configuration=Release