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 6477701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:58:50+00:00 2026-05-25T06:58:50+00:00

I’m using LinqToActiveDirectory from codeplex and when I’m executing query using DirecotrySource I’m getting

  • 0

I’m using LinqToActiveDirectory from codeplex and when I’m executing query using DirecotrySource I’m getting the following error:

DisconnectedContext was detected

Message: Context 0x3c5050′ is disconnected. Releasing the interfaces from the current context (context 0x3c4f98).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.

This occur only when debugging, if i set breakpoint on the last curly brackets of the method and press F10 to finish the execution.when running with no debug it’s working as expected.
Also, if I’m calling the GC.Collect() before the last curly brackets, i can safely exit.
I don’t want to call the GC as i know that it’s better to leave him to do his work.

I’ll be happy to get any idea about how to solve this isuue.
Thanks, Tamir.

  • 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-05-25T06:58:51+00:00Added an answer on May 25, 2026 at 6:58 am

    You still have this problem in release mode and it will lead to a big crash or data corruption later on, but in debug mode it triggers the Managed Debugging Assistant that is trying to help you fix the issue: http://msdn.microsoft.com/en-us/library/2c1czate.aspx

    In general the problem is that COM components are often owned by a specific thread (depending on how it supports being hosted and where it was created). The most common situation is that you created the context on a background thread or threadpool worker thread and now that thread has gone away (which kills the COM apartment or context, thus killing the COM component) and you later attempt to use the COM object.

    Ultimately System.DirectoryServices uses ADSI which is a set of COM components. So are you passing stuff between threads, using Parallel LINQ, or anything like that? eg: If you are using lazy execution of LINQ on a background thread then passing IEnumerable to the foreground thread, the actual execution of the query will happen on the foreground thread… but if you stick a .ToList() in there, you will force evaluation on the background thread.

    Please let us know if any of this helps and if you are using threading and we can provide more direction.

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

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I'm making a simple page using Google Maps API 3. My first. One marker
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.