microsoft / microsoft/react-native-windows
crash in JSI when trying to print out object
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 17.3k
- Forks
- 1.2k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 33
Description
Using RNW 0.65.7
react-native-xaml defines a JsiHostObject (XamlObject)
The hostobject get method takes a PropertyId value. The method impl for XamlObject converts the property ID to std::string then compares it with some values.
On the JS side, the code does:
<WinUI.ColorPicker onColorChanged={(e) => {
console.log(e.nativeEvent);
}} />
This throws inside the jsi ABI; Chakra throws an exception:
It is illegal to retrieve the name associated with a property symbol
The exception thrown is a std::exception; it is expected that exceptions from winrt are std::hresult_error, which the jsi exceptions won't be; we should document this bit too, otherwise what ends up happening is the app hard crashes.
# Child-SP RetAddr Call Site
00 0000007a`2c5f01d8 00007ff8`8c44358c ntdll!RtlRaiseException [minkernel\ntos\rtl\amd64\raise.c @ 52]
01 0000007a`2c5f01e0 00007ff8`52996480 KERNELBASE!RaiseException+0x6c
02 0000007a`2c5f02c0 00007fff`a5b9766f VCRUNTIME140_APP!_CxxThrowException+0x90 [d:\agent\_work\18\s\src\vctools\crt\vcruntime\src\eh\throw.cpp @ 75]
03 0000007a`2c5f0320 00007fff`a5b93661 Microsoft_ReactNative!Microsoft::JSI::ChakraRuntime::ThrowNativeExceptionOverride+0x2f [D:\a\_work\1\s\vnext\Shared\JSI\ChakraRuntime.cpp @ 623]
04 0000007a`2c5f03b0 00007fff`a5b96115 Microsoft_ReactNative!Microsoft::JSI::ChakraApi::GetPropertyNameFromId+0x5d [D:\a\_work\1\s\vnext\Shared\JSI\ChakraApi.cpp @ 162]
05 0000007a`2c5f03f0 00007fff`a5bec024 Microsoft_ReactNative!Microsoft::JSI::ChakraRuntime::utf8+0x15 [D:\a\_work\1\s\vnext\Shared\JSI\ChakraRuntime.cpp @ 323]
06 0000007a`2c5f0420 00007fff`a5beecaf Microsoft_ReactNative!winrt::Microsoft::ReactNative::implementation::JsiRuntime::PropertyIdToUtf8+0x40 [D:\a\_work\1\s\vnext\Microsoft.ReactNative\JsiApi.cpp @ 585]
07 0000007a`2c5f04a0 00007fff`8ad2d432 Microsoft_ReactNative!winrt::impl::produce<winrt::Microsoft::ReactNative::implementation::JsiRuntime,winrt::Microsoft::ReactNative::IJsiRuntime>::PropertyIdToUtf8+0x2f [C:\vss-agent\2.194.0\BaseIntDir\Microsoft.ReactNative\Generated Files\winrt\Microsoft.ReactNative.h @ 3401]
08 0000007a`2c5f04e0 00007fff`8ad3ec80 ReactNativeXaml!winrt::impl::consume_Microsoft_ReactNative_IJsiRuntime<winrt::Microsoft::ReactNative::IJsiRuntime>::PropertyIdToUtf8+0xc2 [C:\Users\asklar\source\repos\react-native-xaml\package\windows\ReactNativeXaml\Generated Files\winrt\Microsoft.ReactNative.h @ 728]
09 0000007a`2c5f0690 00007fff`8acd65d6 ReactNativeXaml!winrt::Microsoft::ReactNative::JsiAbiRuntime::utf8+0xd0 [C:\Users\asklar\source\repos\react-native-xaml\examplenuget\windows\packages\Microsoft.ReactNative.Cxx.0.65.7\tools\Microsoft.ReactNative.Cxx\JSI\JsiAbiApi.cpp @ 308]
0a 0000007a`2c5f0850 00007fff`8accf8fb ReactNativeXaml!facebook::jsi::PropNameID::utf8+0x66 [C:\Users\asklar\source\repos\react-native-xaml\examplenuget\windows\packages\Microsoft.ReactNative.Cxx.0.65.7\tools\Microsoft.ReactNative.Cxx\jsi\jsi.h @ 436]
0b 0000007a`2c5f0970 00007fff`8ad27659 ReactNativeXaml!XamlObject::get+0x7b [C:\Users\asklar\source\repos\react-native-xaml\package\windows\ReactNativeXaml\XamlObject.cpp @ 129]
0c 0000007a`2c5f0e80 00007fff`8ad27489 ReactNativeXaml!winrt::Microsoft::ReactNative::JsiHostObjectWrapper::GetProperty+0xd9 [C:\Users\asklar\source\repos\react-native-xaml\examplenuget\windows\packages\Microsoft.ReactNative.Cxx.0.65.7\tools\Microsoft.ReactNative.Cxx\JSI\JsiAbiApi.cpp @ 97]
0d 0000007a`2c5f10a0 00007fff`a5bea7b2 ReactNativeXaml!winrt::impl::produce<winrt::Microsoft::ReactNative::JsiHostObjectWrapper,winrt::Microsoft::ReactNative::IJsiHostObject>::GetProperty+0xb9 [C:\Users\asklar\source\repos\react-native-xaml\package\windows\ReactNativeXaml\Generated Files\winrt\Microsoft.ReactNative.h @ 3274]
0e (Inline Function) --------`-------- Microsoft_ReactNative!winrt::impl::consume_Microsoft_ReactNative_IJsiHostObject<winrt::Microsoft::ReactNative::IJsiHostObject>::GetProperty+0x26 [C:\vss-agent\2.194.0\BaseIntDir\Microsoft.ReactNative\Generated Files\winrt\Microsoft.ReactNative.h @ 617]
0f 0000007a`2c5f12c0 00007fff`a5b97e53 Microsoft_ReactNative!winrt::Microsoft::ReactNative::implementation::HostObjectWrapper::get+0x52 [D:\a\_work\1\s\vnext\Microsoft.ReactNative\JsiApi.cpp @ 272]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with XamlObject.cpp at the get implementation and trace the PropertyIdToUtf8 path through JsiApi.cpp and ChakraApi.cpp, reproducing the console.log(e.nativeEvent) case. Done should prevent the JSI exception from hard-crashing the app and document the relevant exception behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, react-native
- Domain
- desktop-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100