microsoft / microsoft/react-native-windows

Unsafe code in C# results in "ReactNativeCodeGen.rsp exited with code 1"

Open
#13,491 2 comments 0 reactions 1 assignee View on GitHub

@vmoroz is already working on this.

Since Jul 25, 2024.

Area: Native Modules bug Old Architecture Scenario: C# Workstream: New Arch C# Support
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Problem Description

Using any unsafe code in native modules causes the project to fail when running in a debug configuration

Steps To Reproduce
  1. Allow unsafe blocks in csproj.
  2. Declare any type of unsafe code, blocks or methods.
  3. Run.
Expected Results

No response

CLI version

13.6.9

Environment
System:
  OS: Windows 10 10.0.19045
  CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
  Memory: 2.10 GB / 7.73 GB
Binaries:
  Node:
    version: 20.15.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm:
    version: 10.8.2
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Enabled
    Versions:
      - 10.0.19041.0
      - 10.0.22621.0
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.10.35027.167 (Visual Studio Community 2022)
Languages:
  Java: Not Found
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 13.6.9
    wanted: ^13.6.2
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.3
    wanted: ^0.74.3
  react-native-windows:
    installed: 0.74.11
    wanted: 0.74.11
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Community Modules

@react-native-community/cli

Target Platform Version

None

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

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

Here is an example from React-native-windows-samples that uses NativeModuleSample.
Same result on both Windows 10 and 11.

Message when using --logging:
"C:\Users\User\Documents\AwesomeProject\node_modules\react-native-windows\target\x64\Debug\Microsoft.ReactNative.Managed.CodeGen\publish\Microsoft.ReactNative.Managed.CodeGen.exe

@C\Users\User\Documents\AwesomeProject\windows\AwesomeProject\obj\x64\Debug\awesomeproject.ReactNativeCodeGenawesomeproject.ReactNativeCodeGen.rsp" exited with code 1.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.