chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hi,

I have a test that tests some part of my code, the test raises 100 threads that add creates and add new objects we use.
The test intermittently crashes on one of the background threads.
I have raised the number of threads to 1000 and now it happens more frequently (at least 1 crash in 1-5 runs).
The call stack indicates that it throws a KeyNotFoundException in typemock code.
The code in which it seems to crash is registering a delegate on an event but they are not mocked...

The call stack shows:
Got exception. Thread=AddSuccessedMultiThreads Worker Thread 435, ex=System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at gv.a(Object A_0, String A_1, Object[] A_2)
at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Boolean A_5, Object[] A_6)
at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected, Boolean isInterceptedType, Object p1)
at Indigo.Infra.ManagedData.ManagedDataInfra.ManagedData.add_PropertyChanged(PropertyChangedEventHandler value)
... internal code

Can you please check to see what the crashing code is doing? perhaps it will help me understand if this is something i'm doing wrong or a bug?

Thanks,
Moshe.
asked by MosheH (1.1k points)

4 Answers

0 votes
Hi Moshe,

I will look into this.
Can you send me the test code as well?
answered by alex (17k points)
0 votes
Sorry for replying only now.
AFAIK I can't send the code (legal stuff), i'll have to check if i'm allowed to send dlls that reproduce it.
I don't have something standalone that reproduces it without the rest of the system.

Thanks,
Moshe
answered by MosheH (1.1k points)
0 votes
Hi Moshe,

Maybe it is possible to send me only the test code, any information might help.
Also, which Isolator version do you use?
answered by alex (17k points)
0 votes
Hi Moshe,

Can you please send us a similar test code that will demonstrate this issue?

You can send it via mail.
answered by NofarC (4k points)
...