We have some C# code that uses COM (its calling legacy code).
When an event happens, a COM event is fired.
Everything works perfectly.
However, if we call that same code from within a unit test, then suddenly the COM events cease to be fired – its just silence, like some sort of empty room with no party.
Any ideas why?
Environment:
- Microsoft Visual Studio 2008.
- Unit testing using the built in unit testing for MSVS 2008
Without further details, this is hard to diagnose. However, it is possible that this is actually an apartment issue: IIRC, VS runs tests in an STA. If your application uses an MTA to run the same code, it could be that you are facing deadlocking or similar issues.