-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
ComWrappers test that allocate object can't inline #85583
ComWrappers test that allocate object can't inline #85583
Conversation
There are some JIT stress settings that aggressively inline functions, regardless of size/complexity. This inlining can perturb the subtle GC assumptions inherent in the COM wrappers tests.
Thanks for fixing. There should probably be a roslyn analyzer that takes you add |
Not sure that is good general policy as it is specific to this test and how it is run. For normal xUnit tests, this wouldn't be much of an issue because the test cases are executed via Reflection. The test pattern under Calling |
I was specifically thinking about the couple bugs of this type I've caused in Is there a recommended way to catch these sorts of bugs before I submit a PR? Perhaps running the test in a loop with certain GC stress modes enabled? I can't find documentation what modes would be helpful for catching these sorts of problems. |
Unfortunately not really. A lot of it is experience ex-post since seeing it prior to check-in is hard because of the 1000 other things you are likely worrying about during development. I've personally checked in flakey tests that suffer from this and then had to fix them so you are in good company. The experience part comes into play when you can get the failure and quickly see where the problem is without debugging or flipping on multiple logging tools. For JIT stress the common issue is inlining which can fundamentally change the lifetime of all locals in the inlined frame.
Yep, that is something I regularly do and it helps provide confidence on GC holes, but not always issues like this. Running the test in Checked with I wouldn't take any introduced test issues personally, it is hard to get tests right in general and non-determinism like the GC simply exacerbates an already very hard problem space - writing robust and accurate tests. |
Thanks for the tip about |
There are some JIT stress settings that aggressively inline
functions, regardless of size/complexity. This inlining can
perturb the subtle GC assumptions inherent in the COM
wrappers tests.
Fixes #85262
/cc @jkoritzinsky