How to reproduce:
1. Open the attached "IN-149335" project
2. Locate Edit > Project Settings > Player > Other Settings > Configuration
3. Set Scripting Backend to "IL2CPP"
4. Open File > Build profiles
5. Switch build profile to “Release Windows”
6. Press “Build and Run”
7. After 2-10 minutes Observe the Console window
Actual result: IL2CPP C++ compile step fails with “error C2039: '__U3CU3E927_1': is not a member of 'U3CU3Ec...'" in the generated Simulation.Game__4.cpp, and the player build fails
Expected result: Generated C++ compiles and the IL2CPP player builds
Reproducible with: 6000.0.11f1, 6000.0.81f1, 6000.3.22f1
Could not test with: 6000.0.0f1, 6000.0.10f1 (due to compilation errors), 6000.5.9f1, 6000.6.0b9, 6000.7.0a5 (the project is built on the Entities Aspects API (IAspect), which Entities later removed)
Workaround: Rewrite the offending local function so it does not capture the local DynamicBuffer - pass the buffer in as a parameter (or inline the calls) instead of capturing it - which avoids the closure shape IL2CPP miscompiles
Note: Only the IL2CPP backend is affected; the Mono build compiles and runs the identical code