Open MichalStrehovsky opened 2 years ago
Thank you for reporting this. I think we need to add checks to both SDK (ValidateCrossgen2Support
would be a good place)
https://github.com/dotnet/sdk/blob/f2a00822cb7f182ecf91e0abb0dfa3679748bf2d/src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs#L134 and Crossgen2 compiler.
It seems like this code block in ValidateCrossgen2Support
would return false (not available):
https://github.com/dotnet/sdk/blob/046aea514d5c489ee402886755bd7d71e256f77a/src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs#L155-L168
https://docs.microsoft.com/en-us/dotnet/core/deploying/ready-to-run#cross-platformarchitecture-restrictions Cross compile from Linux to Windows I don't think is supported.
I think that the primary check should be in Crossgen2, it should bail out before trying to call non-existent DIA APIs on Unix. A secondary check in SDK would be also useful to support a smoother developer experience.
Reported on Discord. See the log here. The relevant part of the log:
It looks like crossgen2 is attempting to generate a PDB when running on Linux, but targeting Windows.
I don't see a check that would prevent this. The closest one is:
https://github.com/dotnet/sdk/blob/cf2fd1e514c393cb12e745ab488b6478320fc232/src/Tasks/Microsoft.NET.Build.Tasks/RunReadyToRunCompiler.cs#L321-L325
But that one only checks the target and not the host. The problem is that PDB can only be created when the host is Windows because it uses COM APIs that are only available on Windows.
Cc @dotnet/crossgen-contrib @AntonLapounov