Items added to ConcurrentDictionary immediately go into a zombie state

1

I'm trying to throw together a quick little program using Alchemy Websockets which uses the ConcurrentDictionary collection in its examples.

In the code I wrote, I'm attempting to add a new client to a ConcurrentDictionary. I noticed my script failing in other areas when attempting to access this client and narrowed it down to items I'm adding to the ConcurrentDictionary immediately go into a "zombie" state.

Here's the test code where I add a client:

Client test = new Client(ctx, sessId);
Clients.TryAdd(test, String.Empty);
Console.WriteLine ("Adding new client: " + sessId);

If I use my debugger to break in this area I can see that "test" contains the proper client information, but immediately after adding it to the Clients collection it says "Object is in a zombie state. (Exception from HRESULT: 0x8013134F)".

The dictionary is declared in my class as such:

protected ConcurrentDictionary<Client, string> Clients = new ConcurrentDictionary<Client, string>();

I know I'm probably doing something stupidly obvious but what gives?

c#
mono
concurrentdictionary
asked on Stack Overflow Jul 30, 2012 by DWilliams • edited Jul 30, 2012 by svick

1 Answer

2

If your conclusion is that the items that go into ConcurrentDictionary go into a zombie state, you're assuming that any object does, right? Then, try to test that assumption by writing a smaller program, reduced testcase, that is not coupled to the Client class, or to the WebSockets library at all.

If that still gives you the problem, congrats, you're now narrowing the problem. A second step I would do is then take your smaller program and try to execute it inside MS.NET (not Mono). If it works in MS.NET and not in Mono, then I would file a bug in Mono's bug tracker: http://bugzilla.xamarin.com/.

If, however, your program doesn't work in MS.NET either, then you may be doing something wrong!

answered on Stack Overflow Jul 30, 2012 by knocte

User contributions licensed under CC BY-SA 3.0