Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#852 Exception on testing assembly using OpenMP

2.5
closed-duplicate
nobody
framework (182)
5
2009-07-17
2009-07-17
Timothy Gacek
No

Greetings,

I am unit testing a managed C++/CLI wrapper class around a native C++ class where the native C++ class uses OpenMP. When trying to unit test with OpenMP enabled in the native code, I get the exception OpenMPWithMultipleAppdomainsException from minternal.h in the constructor (type initialization) of my managed assembly that references the native assembly using OpenMP.

#ifdef _PARTIAL_TRUST_OBJ
inline void __cdecl DoDllLanguageSupportValidation()
#else /* _PARTIAL_TRUST_OBJ */
_MRTIMP void __cdecl DoDllLanguageSupportValidation()
#endif /* _PARTIAL_TRUST_OBJ */
{
if (!AppDomain::CurrentDomain->IsDefaultAppDomain() && IsUsingOpenMP())
{
throw gcnew OpenMPWithMultipleAppdomainsException();
}
}
} // namespace __identifier("<CrtImplementationDetails>")

I have tried the various modes in NUnit 2.5 to launch with different default domain usage and different default process models but no combination seems to work. I found the following post online from September 2008 where it seems someone had a similar issue and the reply at the time was that NUnit did not support testing managed assemblies that referenced other libs using OpenMP.

http://osdir.com/ml/windows.dotnet.nunit.user/2008-09/msg00070.html

Is this an unsupported feature or a bug? Or, Is there a workaround for testing this scenario?

cheers,
Tim Gacek

Discussion

  • Charlie Poole
    Charlie Poole
    2009-07-17

    • status: open --> closed-duplicate
     
  • Charlie Poole
    Charlie Poole
    2009-07-17

    For future reference, there's no advantage to submitting the same item as a bug and a feature request. In fact it causes extra administrative overhead. I'm retaining
    feature request #2823105, since this is a major change to the overall design of NUnit.

    It's intrinsic to the NUnit design that tests are run in a separate AppDomain. Running smoothly in the primary AppDomain will require an unmanaged program that hosts the CLR. This is planned for NUnit 3.0.

    As a workaround, you can use the limited nunit-console support for running in a primary appdomain ( /domain:None ) Read the console command line docs carefully before trying this. For further help on the issue, please post to the nunit-discuss group on google.