Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I started the 128 thread one by one & assign the interval at every 1 second but all threads are stop at one location.why this will be happend. when we checking the value of the local variable in the locals it will be disply this exception " Cannot evaluate expression because a native frame is on top of the call stack".
I don't get proper solution for this error. plz help me .
Posted

0) Does the app appear to run okay when you're not running under the debugger?

1) Maybe 128 concurrent threads is too many. Create one and see what happens. If that's okay, create 2, and then 4, and so on.

2) Are all of the objects acted on by the threads thread-safe?

3) Did you google the error? I did and got back over 5,500 results.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-Apr-11 16:04pm    
Correct, my 5.
As always, I insist on preferring thread and avoiding timers.
Please see my Answer.
--Sa
Looks like the threads are sharing a resource which, and looks like the main thread is locking this. This could for example be a semaphore you initialized wrong.

Also, when debugging threads you cannot simply "debug" but need to actually debug a thread. Because there are 128 of them the debugger doesn't understand which of the 128 values it needs to show.

Have a look at this link for some tips:
http://geekswithblogs.net/sdorman/archive/2009/02/14/visual-studio-2008-debugging-tricks-ndash-multi-threaded-debugging.aspx[^]

Good luck!
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 19-Apr-11 16:02pm    
Usually there is not need to use semaphore, where a lock can do; ReaderWriterLockSlim is more flexible option. My 4.
--SA
E.F. Nijboer 20-Apr-11 5:24am    
The semaphore is just an example of something that is easily initialized incorrectly. It is just a wild guess because there is no actual code posted with this question.
Sergey Alexandrovich Kryukov 20-Apr-11 13:05pm    
As soon as multi-threading is mentioned, but not inter-process communication, semaphore is usually not needed.
--SA
Using threading and Timer at the same time look suspect, could be a big design error. Threads should be preferred, timers avoided by all means. It's very rare case when a timer should be used instead of thread.

To fix your problem you really need to use debugger. If you face any problem, try to dump exception in full, post the dump with relevant part of the code.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900