react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

Build error when trying to build project for ARM64 platform

Open Abhishe08k opened this issue 1 year ago • 4 comments

Problem Description

We are trying to support our application for ARM64 platform. But, we are getting build error when we try to build the application for this platform. The error is not getting thrown for other platforms(x86/x64).

Below is the error thrown in case of ARM64. [error]App\Todos\obj\ARM64\Release\XamlTypeInfo.g.cs(5580,13): Error CS8305: 'Microsoft.ReactNative.ReactRootView.ExperimentalUseFabric.set' is for evaluation purposes only and is subject to change or removal in future updates

We have been advised that the project might not be set up right for arm64 regarding suppressing the "this is an experimental API" warning. In general, this is suppressed by the project system.

Windows SDK: Target version : Windows10, version 1903(10.0; Build 18362)

Below is the snippet of the code from the file "XamlTypeInfo.g.cs" because of which error is being thrown.

private void set_170_ReactRootView_ExperimentalUseFabric(object instance, object Value) 
 { 
 var that = (global::Microsoft.ReactNative.ReactRootView)instance; 
 **that.ExperimentalUseFabric = (global::System.Boolean)Value;** 
 }
 
 public global::Windows.UI.Xaml.Markup.IXamlMember GetMemberByLongName(string longMemberName)
         {
             ...
             xamlMember = CreateXamlMember(longMemberName);
             ...
         }
        
  private global::Windows.UI.Xaml.Markup.IXamlMember CreateXamlMember(string longMemberName)
        {
            ...
        switch (longMemberName)
          {
           ...
          case "Microsoft.ReactNative.ReactRootView.ExperimentalUseFabric":
                 userType = (global::Microsoft.Todos.Presentation.Todos_XamlTypeInfo.XamlUserType)GetXamlTypeByName("Microsoft.ReactNative.ReactRootView");
                 xamlMember = new global::Microsoft.Todos.Presentation.Todos_XamlTypeInfo.XamlMember(this, "ExperimentalUseFabric", "Boolean");
                 xamlMember.Getter = get_170_ReactRootView_ExperimentalUseFabric;
                 xamlMember.Setter = set_170_ReactRootView_ExperimentalUseFabric;
                break;
            ...
         }
         ...
         }

Steps To Reproduce

  1. Start supporting the project for ARM64 platform.
  2. Build the project for this platform.

Expected Results

Build should not fail.

CLI version

7.0.4

Environment

System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz
    Memory: 7.00 GB / 15.73 GB
  Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.18.0 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.18362.0, 10.0.19041.0
  IDEs:
    Android Studio: Not Found
    Visual Studio: 16.11.32802.440 (Visual Studio Enterprise 2019)
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^18.0.0 => 18.2.0
    react-native: ^0.68.2 => 0.68.3
    react-native-windows: ^0.68.6 => 0.68.15
  npmGlobalPackages:
    *react-native*: Not Found

Target Platform Version

No response

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2019

Build Configuration

Release

Snack, code example, screenshot, or link to a repository

No response

Abhishe08k avatar Sep 07 '22 04:09 Abhishe08k

Is your app configured to use Fabric for non-Windows platforms?

chrisglein avatar Sep 08 '22 17:09 chrisglein

No, the application is not using Fabric as of now.

Abhishe08k avatar Sep 08 '22 18:09 Abhishe08k

To be clear, is this warning the only thing generating your build failure (treating warnings as errors)? As an immediate workaround, you can suppress this warning. This is a file generated by the XAML compiler so there is no ability to fork it to remove it.

This code in question should probably be under the #ifdefs for Fabric. That seems like the immediate fix here.

Not sure why this works for x86 but doesn't for ARM64. Mismatch in settings for treating warnings as errors?

chrisglein avatar Sep 12 '22 18:09 chrisglein

Thank you for your time. My issue gets resolved after i started ignoring this error for ARM64 configuration.

Abhishe08k avatar Sep 15 '22 11:09 Abhishe08k

@Abhishe08k Looks like this issue is fixed in .71, will you be able to update to .71 or do you need us to backport the change to lower versions?

TatianaKapos avatar Dec 21 '22 20:12 TatianaKapos

Thank you @chrisglein and @TatianaKapos . Backporting is not required.

Abhishe08k avatar Apr 05 '23 04:04 Abhishe08k