File tree Expand file tree Collapse file tree
vnext/Microsoft.ReactNative.Cxx Expand file tree Collapse file tree Original file line number Diff line number Diff line change 158158 </ClCompile >
159159 <ClCompile Include =" $(NodeApiJsiSrcDir)NodeApiJsiRuntime.cpp" >
160160 <PrecompiledHeader >NotUsing</PrecompiledHeader >
161+ <!--
162+ Workaround for a Visual Studio 2026 (v145) C++ optimizer bug. With
163+ optimizations on, this translation unit is miscompiled such that the
164+ pointer-value-scope teardown in NodeApiJsiRuntime hands Hermes a stale
165+ napi_value, crashing in hermes!JSProxy::defineOwnProperty (via
166+ napi_create_reference) during rapid UI updates - e.g. the
167+ e2e-test-app-fabric visitAllPages test. Building this file without
168+ optimization (verified equivalent to `#pragma optimize("", off)`)
169+ avoids it. We must also opt out of /GL here so the disabled
170+ optimization survives link-time code generation. NodeApiJsiRuntime.cpp
171+ is externally provided, so the workaround lives here rather than in the
172+ source. Scoped to v145+ (the bug does not reproduce on v143); remove
173+ when the compiler bug is fixed.
174+ -->
175+ <Optimization Condition =" $(PlatformToolsetVersion)> =145" >Disabled</Optimization >
176+ <WholeProgramOptimization Condition =" $(PlatformToolsetVersion)> =145" >false</WholeProgramOptimization >
161177 </ClCompile >
162178 </ItemGroup >
163179 <ItemGroup Condition =" '$(BuildMSRNCxxNodeApiJsiLoader)' != 'false'" >
You can’t perform that action at this time.
0 commit comments