-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InvalidOperationException from TaskLoggingHelper.FormatResourceString(): The "Csc" task has not registered its resources. #6253
Comments
This was intermittent and happened only once. dotnet/roslyn#46772 is potentially related or same issue. |
I'm running into this issues on MacOs Big Sur when using Project Tye to run a Blazor project. The other projects in the solution (one webapi and one console) build fine. This also only started happening when I upgraded my project to .NET 5 |
Same on big sur with a .NET Core console application. :( |
I'm having the same issues, on Windows 10, and still no solution so far.
|
Team Triage: @KirillOsenkov We're wondering how/where this would be an issue with MSBuild. At first glance this looks like an issue with Roslyn as it's in a targets file under |
@jaredpar we think there's an intermittent issue with the Csc task, any quick guesses? Have you seen this before? |
As far as I can tell, this is where Csc initializes its resources, which is pretty early on, in the constructor of the base class: https://github.com/dotnet/roslyn/blob/275f4c790945c73ca308716ba56c224a95e13ca9/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs#L59 Should it be calling this constructor instead? msbuild/src/Utilities/ToolTask.cs Line 91 in 38da84d
|
Never seen this before nor do I know what is required. Just based off the info here I suspect we're running into the following line At the same time I'm not sure what is missing that we should be doing. |
Yup, you're right, it looks like there's an exception on that line (we don't know which one), and when trying to log it, we fail to get the resource string because resources haven't been initialized. |
Yeah you need to register resources via the constructor or the TaskResources property Line 123 in 7804350
|
I've filed Roslyn issue dotnet/roslyn#52467 - would be nice to fix this soon, as a lot of customers are hitting this |
Turn out this isn't 100% true. The problem is that we're going through So even though our |
Yeah I think I saw you're creating an isolated |
Yep. Thats' what I get for trying to use the right API for logging exceptions 😦 Fix is easy but testing requires me to restructure the code a bit. |
Team Triage: Closing since the fix is available within roslyn. @jaredpar if you think there's anything we can do in our API to make this easier, let us know. |
IMHO, you should really consider one of two bug fixes here:
This seems relatively safe because in the cases where this has an impact the code would already be in a failure state. I imagine I'm not the only one who making the assumption that a type named |
Sorry, accidentally button slip and hit re-open. |
Sounds to me like a reasonable ask, Reopening for triage |
BLARG you also need to manually set At this point I think the fastest way to fix this bug is to stop using |
@benvillalobos in dotnet/runtime we've gotten random build failures with this callstack. +1 to some fix this iteration. |
This was fixed in dotnet/roslyn#52836. Newer versions of the SDK should have the fix and give the correct stack traces. |
Hi @jaredpar I was wondering what is it that I need to update in order to get the fix? I am a little lost. |
My expectation is that this would be included in 5.0.301 as that change went into VS 16.10. Can you grab a bin log of the build there and share that out? Want to make sure it's using the expected compiler vs. getting one pushed in via a package. Note: since this bug was closed we did see the failures start to popup in our repos. This is the most likely candidate at the moment dotnet/runtime#53420 |
Hi @jaredpar here is what I could get. I have never generated a binlog before. I was expecting a file to be generated, but I can't find one in the path I specified... so I am just attaching the console output. Not sure if it's this what you need. Let me know if there is anything else I could get for you.
And the output of
|
@dglozano thanks that confirmed my suspicions Your project / solution has an installation of Microsoft.Net.Compilers that is overriding the C# compiler that comes from the SDK. Removing that will let you use the C# compiler that comes with the SDK that should have this fix. Note: in general that package is not supported for long term usage of this sort. It is meant as a mechanism for shipping short term patches to customers only. |
Thanks @jaredpar ! Can confirm that removing the nuget package fixed the issue 🎊 |
Similar to other tasks we fixed previously we need to ensure that resources are set correctly when creating the `CopyRefAssembly` task. The only correct way to do this is pass the `ResourceManager` through the constructor. Follow up of #52836 Related to dotnet/msbuild#6253
I got the same problem. And it is very interesting that when I run Visual Studio as administrator, I was able to get build without any problem. |
@cihancoskun at this point it's better to open a new issue with any other info. I would also try repairing your installs since maybe a file has the wrong ACL? (not sure whether repair fixes ACLS) |
I have got the same issue and tried to rebuild and my Jenkins jobs completed successfully, looks like this is an intermittent issue |
Building using bootstrap MSBuild from 80b7f2d has resulted in a Csc failure:
The text was updated successfully, but these errors were encountered: