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

code push package not building with react native windows. #2235

Open
arunvenkat1911 opened this issue Mar 7, 2022 · 22 comments
Open

code push package not building with react native windows. #2235

arunvenkat1911 opened this issue Mar 7, 2022 · 22 comments

Comments

@arunvenkat1911
Copy link

Problem Description

Hi Team,

I am working on code push for native windows app. I have done the initial set up for the project and got the app working fine in my local. But when I included the code push package, the app is not building.

Steps To Reproduce

  1. npx react-native init
  2. cd projectName
  3. npx react-native-windows-init --overwrite --language cs
  4. npm install react-native-code-push
  5. npx react-native autolink-windows
  6. npx react-native run-windows

Expected Results

The build should be success and the app should be launched fine.

CLI version

6.3.1

Environment

info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 5.37 GB / 31.75 GB
  Binaries:
    Node: 16.7.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 7.20.3 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.16299.0, 10.0.17134.0, 10.0.17763.0, 10.0.18362.0, 10.0.19041.0, 10.0.20348.0, 10.0.22000.0
  IDEs:
    Android Studio: Not Found
    Visual Studio: 17.0.32014.148 (Visual Studio Professional 2022), 16.11.32002.261 (Visual Studio Professional 2019)
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.66.0 => 0.66.0
    react-native-windows: 0.66.6 => 0.66.6
  npmGlobalPackages:
    *react-native*: Not Found

Target Platform Version

No response

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

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

No response

@chrisglein
Copy link
Member

@arunvenkat1911 Can you share the build log that contains the failure?

@arunvenkat1911
Copy link
Author

Attaching the Build log.
BuildLog.txt

Also please have a look at the errors that we get while running the app from visual studio.
CodePushVSError

@ghost ghost added the Needs: Attention 👋 label Mar 8, 2022
@chrisglein
Copy link
Member

From that build log:

× Build failed with message Building Solution - error code 1. Check your build configuration.
× It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running E:\Samples\CodePush\windowscodepushsample\node_modules\react-native-windows\scripts\rnw-dependencies.ps1 from an elevated PowerShell prompt.
For more information, go to http://aka.ms/rnw-deps
Re-run the command with --logging for more information

Can you check to see if your dependencies are set up correctly with that script? (and enable logging and report back if it's reporting an issue)

@arunvenkat1911
Copy link
Author

Please have a look at the attached file.

The issue is coming from code push package added.
BuildLogWithFullLogging.txt

E:\Samples\CodePush\windowscodepushsample\node_modules\react-native-code-push\windows\CodePush\CodePushConfig.cpp(18,36): error C2259: 'winrt::Microsoft::CodePush::ReactNative::implementation::CodePushConfig': cannot instant
iate abstract class [E:\Samples\CodePush\windowscodepushsample\node_modules\react-native-code-push\windows\CodeP
ush\CodePush.vcxproj]

@chrisglein
Copy link
Member

chrisglein commented Mar 17, 2022

Something in RNW's codepush support is interacting with cppwinrt wrong. Let's follow up with an issue on that repo to make sure it's tracked.

@Rushiraj-karm
Copy link

I am facing same issue,
did anyone find solution for same ?

@rahman2835
Copy link

@Rushiraj-karm nope. We did not hear any thing from Microsoft team.

@Boiko33
Copy link

Boiko33 commented Oct 17, 2022

Facing same issue with:
react-native: 0.70.3
react-native-windows: 0.70.3
react-native-code-push: 7.0.5
Did smb find any solutions?

@tmjordan
Copy link

tmjordan commented Nov 7, 2022

I have the exact same issue. Please any solution or workaround?
Thanks

@Boiko33
Copy link

Boiko33 commented Nov 9, 2022

@tmjordan Unfortunately I didn't find any working solution. In the case that currently I am not using code-push for especially windows app, only for iOS/Android, I just removed this package from windows platform in react-native.config.js. And waiting for some new updates or whatever

@rahman2835
Copy link

There is no working solution as of now. we are also waiting for the same.

@rahman2835
Copy link

@vmoroz any update on this issue?

@DrewHigginsMSFT
Copy link

Any updates on this issue? Was investigating using Code Push on my team's RNW app but ran into this issue that seems like it's been ongoing for over a year?

@rahman2835
Copy link

any update on this issue?

@asklar
Copy link
Member

asklar commented Sep 25, 2023

the CodePushConfig type does not have a constructor so an instance of it cannot be constructed. It looks like you are supposed to call the static methods on that type only, not construct an instance of it.
See example in https://github.com/microsoft/react-native-code-push/blob/master/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/App.cpp#L79

@joshuayoes
Copy link

I spent an hour or two with an engineer to take a closer look at this:

The header file tries to define a private static instance of this class:

static CodePushConfig s_currentConfig;

Earlier in the file, there is a CodePushConfigT template class that seems to be including some logic to allow for CodePushConfig to be turned into a class to be instantiated.

struct CodePushConfig : CodePushConfigT<CodePushConfig>

However, that template class is auto-generated and not included in the git repository, so I can't include here.

@asklar
Copy link
Member

asklar commented Sep 25, 2023

that's just the implementation (see the ::implementation part of the namespace in line 14), so you're not supposed to use that; instead you should use the same type but without the ::implementation namespace. See the example in https://github.com/microsoft/react-native-code-push/blob/master/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/App.cpp#L79

@vmoroz
Copy link
Member

vmoroz commented Sep 25, 2023

I spent an hour or two with an engineer to take a closer look at this:

The header file tries to define a private static instance of this class:

static CodePushConfig s_currentConfig;

Earlier in the file, there is a CodePushConfigT template class that seems to be including some logic to allow for CodePushConfig to be turned into a class to be instantiated.

struct CodePushConfig : CodePushConfigT<CodePushConfig>

However, that template class is auto-generated and not included in the git repository, so I can't include here.

@joshuayoes , it seems that the issue is related to the changes in our project templates that use C++/WinRT. We now prohibit instantiation of WinRT classes directly. They must be created with winrt::make. I will see how to fix it here.

@vmoroz
Copy link
Member

vmoroz commented Sep 26, 2023

C++ code is fixed in this commit in my fork: vmoroz@06ffaba#diff-817e63f5b664a6f031d60feba3a721bbdab4fc21c058b8548faa485b5cfc523a
I need to fix the example bundle creation before I can submit a PR.

@joshuayoes
Copy link

Thank you so much for taking a look at this @vmoroz!

@mununki
Copy link

mununki commented Feb 21, 2024

I bump to the same issue.

"react-native": "0.72.7",
"react-native-code-push": "^8.1.1",

@vmoroz Was your PR sumitted and merged? When can I expect this issue to be resolved?

@codinglesstech
Copy link

C++ code is fixed in this commit in my fork: vmoroz@06ffaba#diff-817e63f5b664a6f031d60feba3a721bbdab4fc21c058b8548faa485b5cfc523a I need to fix the example bundle creation before I can submit a PR.

thankyou i'll try that with your change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests