Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7950385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:15:16+00:00 2026-06-04T02:15:16+00:00

There is a well-known problem when unit testing managed C++ code in Visual Studio:

  • 0

There is a well-known problem when unit testing managed C++ code in Visual Studio: unmanaged code calling back into managed can’t cross app domains and crashes unit tests, as documented here:
http://social.msdn.microsoft.com/Forums/is/vststest/thread/fc7bc074-ff05-407b-b646-d9e5532c6998
and in more details here:
http://lambert.geek.nz/2007/05/29/unmanaged-appdomain-callback

Using /noisolation flag is one solution but it works only when running tests outside of Visual Studio, meaning you can’t debug your tests in Visual Studio.

For me this is a huge thing. I have hard time understanding that Microsoft doesn’t want to address this issue since at least 2006. Discovering that even Visual Studio 11 beta doesn’t offer anything new here was a major disappointment.

So I turned to NUnit and started running my test with “Use a single AppDomain for all tests” selected. Disappointingly, NUnit displays the message: “An unhandled System.ArgumentException was thrown while executing this test: Cannot pass a GCHandle across AppDomains.” After that it crashes.

I was hoping that I will be able to both debug and avoid GCHandle AppDomain issue. Am I misinterpreting the meaning of the single AppDomain option? Does NUnit 2.6 execute the test in the separate AppDomain and is there still no option to change that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:15:20+00:00Added an answer on June 4, 2026 at 2:15 am

    According to this answer by Charlie Poole at NUnit group:

    https://groups.google.com/forum/?fromgroups&hl=en#!topic/nunit-discuss/elG7oyCOyBw

    NUnit main (driver) program executes in the different AppDomain from the code that gets tested. Single AppDomain means single only for all the code to test.

    Charlie suggested using NUnitLite, which uses a single AppDomain for “everything” and, after testing 0.7 version, I am happy that I can debug my tests of C++/CLI code which uses gcroot.

    UI integration of NUnitLite in Visual Studio would be a great additional bonus, but for now I can live without it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For each of the modern browsers are there well known hooks I can tie
There is this well-known problem that browsers don't put Ajax request in the request
There is well known problem with implementing equals() (and hashCode(), i will speak about
There are well-known algorithms for cryptography to compute modular exponentiation (a^b)%c (like Right-to-left binary
Is there a well-known, portable, good library for C++ process management? I found a
Is there any well-known algorithm (or obvious solution) for transforming a list from order
There is a well known issue when it comes to using .NET value types
It seems to be well-known there is a bug when using JMenuItem.getRootPane(). I read
Is there a well-designed method that can run my ruby program from anywhere? I
A well known problem with Java Applets in webpages is that browsers ignore the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.