msbuild: `UsingTask` fails randomly on Ubuntu x64, only reboot helps
Issue Description
Running on .NET 7 RC 1, Ubuntu x64 VM, I have intermittent errors - no changes to code and sometimes it works, sometimes it doesn’t. If I get into this state, nuking artifacts
and .dotnet
does not help, only reboot seems to help.
I have a very basic setup with custom MSBuild task:
- Project: https://github.com/dotnet/installer/blob/main/src/VirtualMonoRepo/Tasks/VirtualMonoRepo.Tasks.csproj
- Single custom task inside: https://github.com/dotnet/installer/blob/main/src/VirtualMonoRepo/Tasks/VirtualMonoRepo_Initialize.cs
UsingTask
here: https://github.com/dotnet/installer/blob/80ff259cd513dc72a84e347f5b27c9fd9f7094d6/src/VirtualMonoRepo/InitializeVMR.proj#L24
I get following error:
/home/prvysoky/installer/src/VirtualMonoRepo/InitializeVMR.proj(75,5): error MSB4062: The "Microsoft.DotNet.VirtualMonoRepo.Tasks.VirtualMonoRepo_Initialize" task could not be loaded from the assembly /home/prvysoky/installer/artifacts/bin/VirtualMonoRepo.Tasks/Debug/net7.0/VirtualMonoRepo.Tasks.dll. Culture is not supported. (Parameter 'name')
/home/prvysoky/installer/src/VirtualMonoRepo/InitializeVMR.proj(75,5): error MSB4062: vider>b__30_1 is an invalid culture identifier. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
Steps to Reproduce
It’s not a 100% repro but the commands needed are this:
git clone https://github.com/premun/installer
git checkout prvysoky/submodules
cd installer
./build.sh /p:InitializeVMR=true /p:TmpDir=/data/tmp /p:VmrDir=/data/vmr /bl
Either it fails very fast or it says “Initializing empty VMR…” and then it means the task was loaded properly.
Expected Behavior
Task should be loaded from the assembly without problems.
Actual Behavior
MSBuild fails to load the custom task with the following error:
/home/prvysoky/installer/src/VirtualMonoRepo/InitializeVMR.proj(75,5): error MSB4062: The "Microsoft.DotNet.VirtualMonoRepo.Tasks.VirtualMonoRepo_Initialize" task could not be loaded from the assembly /home/prvysoky/installer/artifacts/bin/VirtualMonoRepo.Tasks/Debug/net7.0/VirtualMonoRepo.Tasks.dll. Culture is not supported. (Parameter 'name')
/home/prvysoky/installer/src/VirtualMonoRepo/InitializeVMR.proj(75,5): error MSB4062: vider>b__30_1 is an invalid culture identifier. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
Analysis
Sometimes I get this:
/home/prvysoky/installer/src/VirtualMonoRepo/InitializeVMR.proj(75,5): error MSB4018: System.InvalidOperationException: A suitable constructor for type 't.han' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
sometimes this:
/home/prvysoky/installer/src/VirtualMonoRepo/InitializeVMR.proj(75,5): error MSB4062: vider>b__30_1 is an invalid culture identifier.
Seems like it’s getting pieces of the source file and using it as the culture?
Reboot seems to help always.
Versions & Configurations
- .NET
7.0.0-rc.1.22426.10
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 21 (21 by maintainers)
@JanKrivanek this looks a bit different, I’d say. The one above usually says something about “constructor not found on type __” and then some random characters.
@premun Can you please collect memory dump of that corrupted MSBuild server process and send it to me - preferably by some secure way. Steps:
ps -u | grep nodemode:8
~/.dotnet/shared/Microsoft.NETCore.App/7.0.0-rc.1.22411.12/createdump -p {serverPID}
- please note that createdump is best to be invoked from same runtime using by the processes to be dumpedKilling all dotnets helped. I will try to repro it locally with @premun help, as it might be caused MSBuild persistent process.