nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #01035
[Bug 578702] Re: STA shutdown causes DisconnectedContext
** Changed in: nunit-3.0
Status: New => Incomplete
--
STA shutdown causes DisconnectedContext
https://bugs.launchpad.net/bugs/578702
You received this bug notification because you are a member of NUnit
Core Developers, which is the registrant for NUnit Framework.
Status in NUnit Test Framework: Incomplete
Bug description:
NUnit 3.5.5, VS2005, .Net framework 2
Test fixture attributed "RequiresSTA". Test creates COM objects wrapped in Runtime-Callable Wrappers (RCWs). Tests complete OK but immediately afterwards I see:
"Managed Debugging Assistant 'DisconnectedContext' has detected a
problem in 'C:\Program Files\NUnit 2.5.5\bin\net-2.0\nunit.exe'.
Additional Information: Context 0x19a1c8' is disconnected. Releasing
the interfaces from the current context (context 0x19a110).This may
cause corruption or data loss. To avoid this problem, please ensure
that all contexts/apartments stay alive until the applicationis
completely done with the RuntimeCallableWrappers that represent COM
components that liveinside them."
Suggestion is that NUnit shuts down the STA in which the tests run _before_ the RCWs are finalized.
Work-rounds are to avoid marking the fixture as "RequiresSTA", or to add a GC.Collect() in the TestFixtureTearDown.
References