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
[Codegen] overloaded fromRawValue across modules for ArrayEnum props with type alias uint32_t cause runtime crash #43821
Comments
Thanks for the reproducer @netmaxt3r
Type wrappers could be a solution here, or we could qualify the Let me get back to you on potential solution here. |
we need to consider single module having multiple array enum props as well , which could clash each other in this case |
Ah that's also a really valid scenario |
same problem, need help |
@cortinico any news on the possible approach to fix this ? If i get direction i can start working on a PR |
@netmaxt3r I believe the best solution would be the one you suggested, to wrap the types into a struct and use them so the overload resolution won't be ambiguous. |
@cortinico please see PR #44123 , I am pretty new to codegen, i need to figure out the call stack for |
Summary: codegen generates type alias for array enum props with uint32_t which cause wrong overloaded fromRawValue to call at runtime eventually app to terminate more detailed info at issue #43821 ## Changelog: [Internal] [Fixed] - Codegen for array enum props Pull Request resolved: #44123 Test Plan: TODO Reviewed By: cipolleschi Differential Revision: D56414554 Pulled By: dmytrorykun fbshipit-source-id: 0ec1b65951bc16ff58dd2b119c97a4e3fac2b161
Summary: codegen generates type alias for array enum props with uint32_t which cause wrong overloaded fromRawValue to call at runtime eventually app to terminate more detailed info at issue facebook#43821 ## Changelog: [Internal] [Fixed] - Codegen for array enum props Pull Request resolved: facebook#44123 Test Plan: TODO Reviewed By: cipolleschi Differential Revision: D56414554 Pulled By: dmytrorykun fbshipit-source-id: 0ec1b65951bc16ff58dd2b119c97a4e3fac2b161
Description
codegen generates duplicate
fromRawValue
for array enum type props across different modules in same namespace facebook::react with different type alias foruint32_t
In the reproducer app i used
react-native-webview
as an example to crash with Modal component fromreact-native
Modal generates
node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h
from line 295 for parsingsupportedOrientations
propat line 323
WebView generates
/ios/Pods/Headers/Private/React-Codegen/react/renderer/components/RNCWebViewSpec/Props.h
from line 110 for parsingdataDetectorTypes
propat line 142
both function only differ in result parameter but they same at runtime because of same type alias
In the stack trace of crash we can see it starts to parse
ModalHostViewProps
then callfromRawValue
fromRNCWebViewSpec/Props.h
with method signaturefacebook::react::fromRawValue(facebook::react::PropsParserContext const&, facebook::react::RawValue const&, unsigned int&)
One possible solution i see is using strong warapper class/struct for alias types, Or is there any compiler flag we can use to fix function overloading?
Note:- I haven't used react-native-webview in the js side, it is just for the codegen. If i remove
supportedOrientations
prop completely app wont crashSteps to reproduce
clone repo
https://github.com/netmaxt3r/rn-codegen-runtime-crash
yarn install
bundle install
RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
yarn start
yarn ios
React Native Version
0.73.6
Affected Platforms
Runtime - iOS
Areas
Codegen
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/netmaxt3r/rn-codegen-runtime-crash
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: