CoRegisterMallocSpy causes unit tests to fail periodically
jonwis opened this issue · comments
Discovered in #359, tests that use or validate helpers for CoRegisterMallocSpy cause downstream breaks for correct working code.
This tracks following one of the solutions proposed by @dunhor in #359 (comment)
There's a crash in the tests caused by a bug in COM that's caused by a combination of using
IMallocSpy
and not cleaning up C++/WinRT'sCoIncrementMTAUsage
. Raymond and I have chatted about this a bit offline (as it turns out, this is not the first test to fail because of it), and I've floated a few ideas:
- Simplest thing is to manually call
CoInitialize
as I've suggested above. This bypasses >?>C++/WinRT's logic & we don't hit the issue because we've properly cleaned up COM before process exit- Another simple thing to do is to disable the test, but obviously not ideal
- Another idea I've floated is to tag the tests that use
IMallocSpy
specially and then perform two passes of test invocation: one that excludes theIMallocSpy
-using tests and one that only runs those testsI'm personally a fan of option 1: it's simple and effective. Option 3 would help us avoid these issues moving forward, however.
cc @oldnewthing as well