Skip to content
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

[UWP] UseDotNetNativeToolchain has no effect for ARM64 and is always true #54766

Closed
xperiandri opened this issue Jun 21, 2021 · 15 comments
Closed
Labels
area-UWP untriaged New issue has not been triaged by the area owner

Comments

@xperiandri
Copy link

I try to create AppxBundle from UWP project with disabled UseDotNetNativeToolchain
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>

steps:
- task: VSBuild@1
  displayName: 'Build UWP project Mobile/SuperCharge.Mobile.UWP/SuperCharge.Mobile.UWP.csproj'
  inputs:
    solution: Mobile/SuperCharge.Mobile.UWP/SuperCharge.Mobile.UWP.csproj
    msbuildArgs: '/p:OutputPath="$(build.binariesdirectory)\$(BuildConfiguration)" /p:AppxBundlePlatforms="$(AppxBundlePlatforms)" /p:AppxPackageDir="$(build.artifactStagingDirectory)\AppxPackages" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /p:AppxPackageSigningEnabled=true /p:PackageCertificatePassword="m9ygLxVnJv6PqOGD7Eth"'
    platform: x86
    configuration: Release
    msbuildArchitecture: x64

AppxBundlePlatforms=x86|x64|ARM|ARM64

Because enabling UseDotNetNativeToolchain causes compiler crash on x86 and runtime crash on all the other platforms.
Reproduction https://github.com/xperiandri/Elmish.Uno/tree/UseDotNetNativeToolchain (Tag UseDotNetNativeToolchain)
Project SolutionTemplate

So that I disabled it.
https://github.com/xperiandri/Elmish.Uno/tree/template_fixes (branch template_fixes)

However, build fails

 C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\MakeAppx.exe bundle /d obj\x86\Release\SuperCharge.Mobile.UWP_1.0.0.0_Bundle\ /bv 1.0.0.0 /o /p D:\a\1\a\AppxPackages\SuperCharge.Mobile.UWP_1.0.0.0_Test\SuperCharge.Mobile.UWP_1.0.0.0_x86_x64_ARM_ARM64.msixbundle  
##[error]MakeAppx(0,0): Error : Error info: error 80080204: All app package manifests in a bundle must declare the same values under the XPath *[local-name()='Package']/*[local-name()='Dependencies'].  The values under this XPath declared in the manifest for the package with file name "SuperCharge.Mobile.UWP_1.0.0.0_x64.msix" and package full name "SuperCharge.Mobile_1.0.0.0_x64__erpwnvt9c15zj" at line 11, column 4 don't match those declared in the manifest for the package with file name "SuperCharge.Mobile.UWP_1.0.0.0_x86.msix" and package full name "SuperCharge.Mobile_1.0.0.0_x86__erpwnvt9c15zj" at line 11, column 4.
##[debug]Processed: ##vso[task.logissue type=Error;sourcepath=MakeAppx;linenumber=0;columnnumber=0;code=;]Error info: error 80080204: All app package manifests in a bundle must declare the same values under the XPath *[local-name()='Package']/*[local-name()='Dependencies'].  The values under this XPath declared in the manifest for the package with file name "SuperCharge.Mobile.UWP_1.0.0.0_x64.msix" and package full name "SuperCharge.Mobile_1.0.0.0_x64__erpwnvt9c15zj" at line 11, column 4 don't match those declared in the manifest for the package with file name "SuperCharge.Mobile.UWP_1.0.0.0_x86.msix" and package full name "SuperCharge.Mobile_1.0.0.0_x86__erpwnvt9c15zj" at line 11, column 4.
MakeAppx : error : Error info: error 80080204: All app package manifests in a bundle must declare the same values under the XPath *[local-name()='Package']/*[local-name()='Dependencies'].  The values under this XPath declared in the manifest for the package with file name "SuperCharge.Mobile.UWP_1.0.0.0_x64.msix" and package full name "SuperCharge.Mobile_1.0.0.0_x64__erpwnvt9c15zj" at line 11, column 4 don't match those declared in the manifest for the package with file name "SuperCharge.Mobile.UWP_1.0.0.0_x86.msix" and package full name "SuperCharge.Mobile_1.0.0.0_x86__erpwnvt9c15zj" at line 11, column 4. [D:\a\1\s\Mobile\SuperCharge.Mobile.UWP\SuperCharge.Mobile.UWP.csproj]
##[error]MakeAppx(0,0): Error : Bundle creation failed.
##[debug]Processed: ##vso[task.logissue type=Error;sourcepath=MakeAppx;linenumber=0;columnnumber=0;code=;]Bundle creation failed.
MakeAppx : error : Bundle creation failed. [D:\a\1\s\Mobile\SuperCharge.Mobile.UWP\SuperCharge.Mobile.UWP.csproj]
##[error]MakeAppx(0,0): Error : 0x80080204 - The specified package format is not valid: The package manifest is not valid.
##[debug]Processed: ##vso[task.logissue type=Error;sourcepath=MakeAppx;linenumber=0;columnnumber=0;code=;]0x80080204 - The specified package format is not valid: The package manifest is not valid.
MakeAppx : error : 0x80080204 - The specified package format is not valid: The package manifest is not valid. [D:\a\1\s\Mobile\SuperCharge.Mobile.UWP\SuperCharge.Mobile.UWP.csproj]
##[debug]Processed: ##vso[task.logdetail id=11d4e515-3bf7-4700-9143-a770347879cd;parentid=c77bf52f-a241-45e9-b211-4f76de561715;type=Build;result=Failed;finishtime=2021-06-21T21:54:43.5183991Z;progress=100;state=Completed;parentid=c77bf52f-a241-45e9-b211-4f76de561715;name=;]
Done Building Project "D:\a\1\s\Mobile\SuperCharge.Mobile.UWP\SuperCharge.Mobile.UWP.csproj" (default targets) -- FAILED.

because ARM64 still builds with UseDotNetNativeToolchain=true
You can ensure that by build logs. And by that in Visual Studio in project settings on Build tab if you change the platform, on ARM64 UseDotNetNativeToolchain checkbox always becomes checked. Even if you uncheck it, save, go to another platform and back.

After I changed AppxBundlePlatforms=x86|x64|ARM|ARM64 to AppxBundlePlatforms=x86|x64|ARM build succeeded

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@xperiandri
Copy link
Author

If I try to manually force msbuild /p:Platform=ARM64 /p:Configuration=Release /p:UseDotNetNativeToolchain=false -v:n build fails

CopyFilesToOutputDirectory:
  Copying file from "C:\Users\Andrii\Dev\GitHub\Elmish.Uno\src\Templates\SolutionTemplate\SolutionTemplate\obj\ARM64\R
  elease\netstandard2.0\SolutionTemplate.Programs.dll" to "C:\Users\Andrii\Dev\GitHub\Elmish.Uno\src\Templates\Solutio
  nTemplate\SolutionTemplate\bin\ARM64\Release\netstandard2.0\SolutionTemplate.Programs.dll".
  SolutionTemplate -> C:\Users\Andrii\Dev\GitHub\Elmish.Uno\src\Templates\SolutionTemplate\SolutionTemplate\bin\ARM64\
  Release\netstandard2.0\SolutionTemplate.Programs.dll
  Copying file from "C:\Users\Andrii\Dev\GitHub\Elmish.Uno\src\Templates\SolutionTemplate\SolutionTemplate\obj\ARM64\R
  elease\netstandard2.0\SolutionTemplate.Programs.pdb" to "C:\Users\Andrii\Dev\GitHub\Elmish.Uno\src\Templates\Solutio
  nTemplate\SolutionTemplate\bin\ARM64\Release\netstandard2.0\SolutionTemplate.Programs.pdb".
  Copying file from "C:\Users\Andrii\Dev\GitHub\Elmish.Uno\src\Templates\SolutionTemplate\SolutionTemplate\obj\ARM64\R
  elease\netstandard2.0\SolutionTemplate.Programs.xml" to "C:\Users\Andrii\Dev\GitHub\Elmish.Uno\src\Templates\Solutio
  nTemplate\SolutionTemplate\bin\ARM64\Release\netstandard2.0\SolutionTemplate.Programs.xml".
Done Building Project "C:\Users\Andrii\Dev\GitHub\Elmish.Uno\src\Templates\SolutionTemplate\SolutionTemplate\SolutionT
emplate.fsproj" (default targets).

GetInstalledSDKLocations:
  Searching for SDKs targeting "UAP, 10.0.19041.0".
  Searching for SDKs targeting "Windows, 8.1".
ResolveSDKReferences:
    Reading SDK manifest file "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs\14
  .0\SDKManifest.xml".
    Targeted configuration and architecture "Retail|ARM64"
    Could not find "FrameworkIdentity" attribute "FrameworkIdentity-Retail-ARM64" in the SDK manifest.
    Found "FrameworkIdentity" attribute "Name = Microsoft.VCLibs.140.00, MinVersion = 14.0.29231.0, Publisher = 'CN=Mi
  crosoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'" in the SDK manifest.
    Found "APPX" location attribute "AppX-Retail-x86=.\AppX\Retail\x86\Microsoft.VCLibs.x86.14.00.appx" in the SDK man
  ifest.
    Found "APPX" location attribute "AppX-Retail-x64=.\AppX\Retail\x64\Microsoft.VCLibs.x64.14.00.appx" in the SDK man
  ifest.
    Found "APPX" location attribute "AppX-Retail-ARM=.\AppX\Retail\ARM\Microsoft.VCLibs.ARM.14.00.appx" in the SDK man
  ifest.
    Found "APPX" location attribute "AppX-Retail-ARM64=.\AppX\Retail\ARM64\Microsoft.VCLibs.ARM64.14.00.appx" in the S
  DK manifest.
ExpandSDKReferences:
  Enumerating SDK Reference "Microsoft.VCLibs, Version=14.0" from "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\
  10\ExtensionSDKs\Microsoft.VCLibs\14.0\".
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\NuGet\16.0\Microsoft.NuGet.targets(19
8,5): error : Your project file doesn't list 'win10-arm64' as a "RuntimeIdentifier". You should add 'win10-arm64' to t
he "RuntimeIdentifiers" property in your project file and then re-run NuGet restore. [C:\Users\Andrii\Dev\GitHub\Elmis
h.Uno\src\Templates\SolutionTemplate\SolutionTemplate.UWP\SolutionTemplate.UWP.csproj]
Done Building Project "C:\Users\Andrii\Dev\GitHub\Elmish.Uno\src\Templates\SolutionTemplate\SolutionTemplate.UWP\Solut
ionTemplate.UWP.csproj" (default targets) -- FAILED.


Build FAILED.

"C:\Users\Andrii\Dev\GitHub\Elmish.Uno\src\Templates\SolutionTemplate\SolutionTemplate.UWP\SolutionTemplate.UWP.csproj
" (default target) (1) ->
(ResolveNuGetPackageAssets target) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\NuGet\16.0\Microsoft.NuGet.targets(
198,5): error : Your project file doesn't list 'win10-arm64' as a "RuntimeIdentifier". You should add 'win10-arm64' to
 the "RuntimeIdentifiers" property in your project file and then re-run NuGet restore. [C:\Users\Andrii\Dev\GitHub\Elm
ish.Uno\src\Templates\SolutionTemplate\SolutionTemplate.UWP\SolutionTemplate.UWP.csproj]

    0 Warning(s)
    1 Error(s)

@sfoslund sfoslund removed their assignment Jun 25, 2021
@sfoslund sfoslund transferred this issue from dotnet/sdk Jun 25, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jun 25, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@tommcdon
Copy link
Member

Hi @xperiandri, .NET native is required for ARM64 and so UseDotNetNativeToolchain should be true for both Debug and Release builds. An AppX bundle containing ARM64 + other archictectures needs to be built with the same framework, so UseDotNetNativeToolchain should be true.

@xperiandri
Copy link
Author

@tommcdon, OK, where do I need to open an issue about my reproduction?
Enabling native toolchain causes compiler to crush. Hence I cannot build ARM64 at all.

@tommcdon
Copy link
Member

Hi @xperiandri. Sorry to hear that the app is crashing on ARM64. Is this related to #54765 or a different issue?

@xperiandri
Copy link
Author

Yes, it is

@xperiandri
Copy link
Author

It crushes locally as well

@xperiandri
Copy link
Author

This is the issue that has a mention that F# is already have to work

dotnet/corert#6055

@tommcdon
Copy link
Member

F# is unsupported on .NET native. We added the gatekeeper opt-out switch to allow .NET native to compile F# apps to enable customers to try it out.

@xperiandri
Copy link
Author

So why ARM64 must use native toolchain only?

@tommcdon
Copy link
Member

The .NET native toolchain ships a special version of the .NET Core runtime for the F5 developer inner loop performance reasons. ARM64 support was added to .NET native 2.2. The version of .NET core used with the toolchain does not support ARM64.

@xperiandri
Copy link
Author

I don't understand from your answer why .NET native cannot be disabled for ARM64

@tommcdon
Copy link
Member

tommcdon commented Jun 29, 2021

I don't understand from your answer why .NET native cannot be disabled for ARM64

The toolchain does not ship an ARM64 coreclr, so .NET native is the only option for ARM64

@xperiandri
Copy link
Author

Can't it be shipped separately?

@ghost ghost locked as resolved and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-UWP untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

4 participants