Skip to content
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

CoRegisterMallocSpy causes unit tests to fail periodically #393

Closed
jonwis opened this issue Nov 15, 2023 · 0 comments · Fixed by #421
Closed

CoRegisterMallocSpy causes unit tests to fail periodically #393

jonwis opened this issue Nov 15, 2023 · 0 comments · Fixed by #421
Labels
bug Something isn't working

Comments

@jonwis
Copy link
Member

jonwis commented Nov 15, 2023

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's CoIncrementMTAUsage. 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:

  1. 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
  2. Another simple thing to do is to disable the test, but obviously not ideal
  3. 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 the IMallocSpy-using tests and one that only runs those tests

I'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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants