-
Notifications
You must be signed in to change notification settings - Fork 509
[CppCodeGen] Thread unable to start due to assert #4428
Comments
The problem is that CppCodeGen does not emit reverse PInvoke transition. We have hacked around it for the main entrypoint here. Other entrypoints - like new thread entrypoint - are missing the transition, and that's why you see this assert. The fix should be to:
|
@jkotas |
@hippiehunter Thank you for taking a look! Ok, there are really two separate bugs here: one is in ReversePInvoke and second one is in PInvoke. My comment was about how to first the first bug. To verify that your fix for the first bug is working well, you can comment out the IsCurrentThreadInCooperativeMode assert temporarily and see whether the thread gets created gracefully. If it does, feel free to submit the PR with the fix. We prefer more smaller PRs. There is a bit more code missing to fix the second bug, but it should not be large:
|
@jkotas I ran into an interesting problem with PInvokeTransitionFrame, because its defined in rhbinder.h and that's not accessible in the generated cpp code, I've had to match its layout as a duplicate declaration in CPPCodeGen.h. Unfortunately the platform macros don't appear to be applicable here so as a prototype I hard coded the field sizes. With the hard coded field sizes things appear to be working. Is there a right way to get PInvokeTransitionFrame to be accessible inside the generated cpp files? |
Duplicating the required defininitions inside CPPCodeGen.h should be fine.
I would fix this by introducing portable definition of PInvokeTransitionFrame that does not vary from platform to platform.
|
cs prog
cpp assert
The text was updated successfully, but these errors were encountered: