-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Avoid BuildHost crash in Mono due to missing types #74392
Conversation
3310426
to
2ddb948
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this, but would like @jasonmalinowski to take a look as well.
return LoadProjectFileCoreAsync(projectFilePath, languageName, cancellationToken); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] // Do not inline this, since this uses MSBuild types which are being loaded by the caller |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to make a note that this was mono specific, lest somebody tries to undo this change being confused why it works on other platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I've updated the comment now.
I filed #74407 to look at what it'd take to get our tests running on mono to catch issues like this. |
2ddb948
to
26593eb
Compare
The LoadProjectFileAsync routine calls EnsureMSBuildLoaded to make sure the Microsoft.Build.dll is accessible, but requires types from that assembly within the routine itself. This may not always work with Mono, as the JIT may look up the types during compilation. Fixed by splitting out a LoadProjectFileCoreAsync routine, similarly to what is already done for GetProjectsInSolution. Fixes dotnet/runtime#101121.
26593eb
to
3bcf996
Compare
Not sure why this is failing now after just a comment change ... seems an infrastructure issue. |
I wanted to run the roslyn test suite on Linux on arm64. Building everything worked, but running tests would fail with errors like: Errors Microsoft.CodeAnalysis.CSharp.Emit.UnitTests_1 Could not find 'dotnet' host for the 'X64' architecture. You can resolve the problem by installing the 'X64' .NET. With the changes in this commit, I can build and run all tests using: $ ./eng/build.sh --restore --build --pack $ ./eng/build.sh --test I would, eventually, like to be able to run the tests on other platforms, including s390x and ppc64le. Hopefully that might help identify/fix issues like dotnet#74392 earlier. One thing I am not too happy about in this change is how many places need an explicit addition of "linux-arm64". That won't scale as we want to add more architectures.
I wanted to run the roslyn test suite on Linux on arm64. Building everything worked, but running tests would fail with errors like: Errors Microsoft.CodeAnalysis.CSharp.Emit.UnitTests_1 Could not find 'dotnet' host for the 'X64' architecture. You can resolve the problem by installing the 'X64' .NET. With the changes in this commit, I can build and run all tests using: $ ./eng/build.sh --restore --build --pack $ ./eng/build.sh --test I would, eventually, like to be able to run the tests on other platforms, including s390x and ppc64le. Hopefully that might help identify/fix issues like dotnet#74392 earlier. One thing I am not too happy about in this change is how many places need an explicit addition of "linux-arm64". That won't scale as we want to add more architectures.
I wanted to run the roslyn test suite on Linux on arm64. Building everything worked, but running tests would fail with errors like: Errors Microsoft.CodeAnalysis.CSharp.Emit.UnitTests_1 Could not find 'dotnet' host for the 'X64' architecture. You can resolve the problem by installing the 'X64' .NET. With the changes in this commit, I can build and run all tests using: $ ./eng/build.sh --restore --build --pack $ ./eng/build.sh --test I would, eventually, like to be able to run the tests on other platforms, including s390x and ppc64le. Hopefully that might help identify/fix issues like dotnet#74392 earlier. One thing I am not too happy about in this change is how many places need an explicit addition of "linux-arm64". That won't scale as we want to add more architectures.
I wanted to run the roslyn test suite on Linux on arm64. Building everything worked, but running tests would fail with errors like: Errors Microsoft.CodeAnalysis.CSharp.Emit.UnitTests_1 Could not find 'dotnet' host for the 'X64' architecture. You can resolve the problem by installing the 'X64' .NET. With the changes in this commit, I can build and run all tests using: $ ./eng/build.sh --restore --build --pack $ ./eng/build.sh --test I would, eventually, like to be able to run the tests on other platforms, including s390x and ppc64le. Hopefully that might help identify/fix issues like dotnet#74392 earlier. One thing I am not too happy about in this change is how many places need an explicit addition of "linux-arm64". That won't scale as we want to add more architectures.
I wanted to run the roslyn test suite on Linux on arm64. Building everything worked, but running tests would fail with errors like: Errors Microsoft.CodeAnalysis.CSharp.Emit.UnitTests_1 Could not find 'dotnet' host for the 'X64' architecture. You can resolve the problem by installing the 'X64' .NET. With the changes in this commit, I can build and run all tests using: $ ./eng/build.sh --restore --build --pack $ ./eng/build.sh --test I would, eventually, like to be able to run the tests on other platforms, including s390x and ppc64le. Hopefully that might help identify/fix issues like dotnet#74392 earlier. One thing I am not too happy about in this change is how many places need an explicit addition of "linux-arm64". That won't scale as we want to add more architectures.
I wanted to run the roslyn test suite on Linux on arm64. Building everything worked, but running tests would fail with errors like: Errors Microsoft.CodeAnalysis.CSharp.Emit.UnitTests_1 Could not find 'dotnet' host for the 'X64' architecture. You can resolve the problem by installing the 'X64' .NET. With the changes in this commit, I can build and run all tests using: $ ./eng/build.sh --restore --build --pack $ ./eng/build.sh --test I would, eventually, like to be able to run the tests on other platforms, including s390x and ppc64le. Hopefully that might help identify/fix issues like #74392 earlier. One thing I am not too happy about in this change is how many places need an explicit addition of "linux-arm64". That won't scale as we want to add more architectures.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
The test run failed. Think it's still using stale integration test bits. Worry that this PR may be snagged on stale state. I rebased locally, pushed to a new branch and opened a new PR. Hopefully that one will get past these issues #74994. |
Closing as I got this change to merge in cleanly in #74994. Sorry for losing track of this. |
The LoadProjectFileAsync routine calls EnsureMSBuildLoaded to make sure the Microsoft.Build.dll is accessible, but requires types from that assembly within the routine itself. This may not always work with Mono, as the JIT may look up the types during compilation.
Fixed by splitting out a LoadProjectFileCoreAsync routine, similarly to what is already done for GetProjectsInSolution.
Fixes dotnet/runtime#101121.