473,416 Members | 1,928 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

ContextSwitchDeadlock Problem



Hi,

As iam working on convertion of C#1.1 to 2.0. Iam facing a problem
(screen is flickered) while opening and closing any artifacts. When i
tried to debug it is througing ContextSwitchDeadlock MDA exception i.e.

The CLR has been unable to transition from COM context 0x1a0768 to COM
context 0x1a08d8 for 60 seconds. The thread that owns the destination
context/apartment is most likely either doing a non pumping wait or
processing a very long running operation without pumping Windows
messages. This situation generally has a negative performance impact and
may even lead to the application becoming non responsive or memory usage
accumulating continually over time. To avoid this problem, all single
threaded apartment (STA) threads should use pumping wait primitives
(such as CoWaitForMultipleHandles) and routinely pump messages during
long running operations.

please suggest...

*** Sent via Developersdex http://www.developersdex.com ***
Feb 13 '07 #1
7 8084
Could be a false positive because of debugger.
Check if this applies:
http://blogs.msdn.com/jmstall/archiv...hDeadLock.aspx

"Kalpana" <ka*****@devdex.comha scritto nel messaggio
news:eS**************@TK2MSFTNGP04.phx.gbl...
>

Hi,

As iam working on convertion of C#1.1 to 2.0. Iam facing a problem
(screen is flickered) while opening and closing any artifacts. When i
tried to debug it is througing ContextSwitchDeadlock MDA exception i.e.

The CLR has been unable to transition from COM context 0x1a0768 to COM
context 0x1a08d8 for 60 seconds. The thread that owns the destination
context/apartment is most likely either doing a non pumping wait or
processing a very long running operation without pumping Windows
messages. This situation generally has a negative performance impact and
may even lead to the application becoming non responsive or memory usage
accumulating continually over time. To avoid this problem, all single
threaded apartment (STA) threads should use pumping wait primitives
(such as CoWaitForMultipleHandles) and routinely pump messages during
long running operations.

please suggest...

*** Sent via Developersdex http://www.developersdex.com ***

Feb 13 '07 #2

It is not working.
Is there is any chance of having this problem due to the handles invoked
from WndProc()?

Previoulsy i had a problem with Utilitylibrary.Rebar --WndProc()
recursive call (deadlock). I posted this problem but no one reply --so
for the temporary survive i kept a condition for termination (to avoid
deadlock). condition is:
if (m.Msg == (int)Msg.WM_WINDOWPOSCHANGED)
return;
if condition reaches then control will be returned from WndProc().

Is this present problem of flickering (when we don't debug) and
ContextSwitchDeadLock exception --(when we debug -- see the exception
below) is due to WndProc() condition??
However please suggest

EXCEPTION DESCRIPTION:
The CLR has been unable to transition from COM context 0x1a0768 to COM
context 0x1a08d8 for 60 seconds. The thread that owns the destination
context/apartment is most likely either doing a non pumping wait or
processing a very long running operation without pumping Windows
messages. This situation generally has a negative performance impact and
may even lead to the application becoming non responsive or memory usage
accumulating continually over time. To avoid this problem, all single
threaded apartment (STA) threads should use pumping wait primitives
(such as CoWaitForMultipleHandles) and routinely pump messages during
long running operations.

*** Sent via Developersdex http://www.developersdex.com ***
Feb 13 '07 #3
WndProc should be considered as non re-entrant (and this not recursive).
If you must send messages to other controls owned by you, use PostMessage
(non blocking), not SendMessage (blocking).

"Kalpana" <ka*****@devdex.comha scritto nel messaggio
news:%2****************@TK2MSFTNGP06.phx.gbl...
>
It is not working.
Is there is any chance of having this problem due to the handles invoked
from WndProc()?

Previoulsy i had a problem with Utilitylibrary.Rebar --WndProc()
recursive call (deadlock). I posted this problem but no one reply --so
for the temporary survive i kept a condition for termination (to avoid
deadlock). condition is:
if (m.Msg == (int)Msg.WM_WINDOWPOSCHANGED)
return;
if condition reaches then control will be returned from WndProc().

Is this present problem of flickering (when we don't debug) and
ContextSwitchDeadLock exception --(when we debug -- see the exception
below) is due to WndProc() condition??
However please suggest

EXCEPTION DESCRIPTION:
The CLR has been unable to transition from COM context 0x1a0768 to COM
context 0x1a08d8 for 60 seconds. The thread that owns the destination
context/apartment is most likely either doing a non pumping wait or
processing a very long running operation without pumping Windows
messages. This situation generally has a negative performance impact and
may even lead to the application becoming non responsive or memory usage
accumulating continually over time. To avoid this problem, all single
threaded apartment (STA) threads should use pumping wait primitives
(such as CoWaitForMultipleHandles) and routinely pump messages during
long running operations.

*** Sent via Developersdex http://www.developersdex.com ***

Feb 13 '07 #4
"Kalpana" <ka*****@devdex.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>
It is not working.
Is there is any chance of having this problem due to the handles invoked
from WndProc()?

Previoulsy i had a problem with Utilitylibrary.Rebar --WndProc()
recursive call (deadlock). I posted this problem but no one reply --so
for the temporary survive i kept a condition for termination (to avoid
deadlock). condition is:
if (m.Msg == (int)Msg.WM_WINDOWPOSCHANGED)
return;
if condition reaches then control will be returned from WndProc().
We realy can't help you if you are only posting some lines of code, what else are you doing
after this..
if (m.Msg == (int)Msg.WM_WINDOWPOSCHANGED)
return;
..... // ????

Willy.

Feb 13 '07 #5

protected override void WndProc(ref Message m) {
if (m.Msg == (int)Msg.WM_WINDOWPOSCHANGED)
return;
base.WndProc(ref m);

switch (m.Msg)
{
case (int)Msg.WM_PAINT:
PaintBackground();
break;
case (int)Msg.WM_NOTIFY:
case (int)((int)Msg.WM_NOTIFY + (int)Msg.WM_REFLECT):
{
NMHDR note = (NMHDR)m.GetLParam(typeof(NMHDR));
switch (note.code)
{
case
(int)RebarNotifications.RBN_HEIGHTCHANGE:
UpdateSize();
break;

case
(int)RebarNotifications.RBN_CHEVRONPUSHED:
NotifyChevronPushed(ref m);
break;

case (int)RebarNotifications.RBN_CHILDSIZE:
NotifyChildSize();
break;
case (int)NotificationMessages.NM_NCHITTEST:
break;
}
}
break;
}
}

*** Sent via Developersdex http://www.developersdex.com ***
Feb 14 '07 #6

Hi,

I used PostMessage() instead SenMessage() this avoided blocking i.e.
infinite loop but giving unhandled Exception:

AccessViolationException: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt

I searched the cause of this exception but that solutions are not
helping the need (like debugger setting from tools --options)

My application Rebar --toolbar is not visible and Navigations are not
working fine :(

NOTE: POSTMESSAGE() is used only for user coded wndproc() methods still
SENDMESSAGE()exists.

IMPORTANT NOTE is all these problems are due to the Utility Library
Rebar --WndProc() handles issue. if we use the new toolstrip from VS
2005 these problems doesnot exists.

There is a necessity with Utility library Rebar --WndProc() --i want
to solve this issue

Please suggest...

*** Sent via Developersdex http://www.developersdex.com ***
Feb 14 '07 #7
Can you get the stack trace of the exception?

"Kalpana Naraboina" <ka***************@semanticspace.comha scritto nel
messaggio news:ej**************@TK2MSFTNGP04.phx.gbl...
>
Hi,

I used PostMessage() instead SenMessage() this avoided blocking i.e.
infinite loop but giving unhandled Exception:

AccessViolationException: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt

I searched the cause of this exception but that solutions are not
helping the need (like debugger setting from tools --options)

My application Rebar --toolbar is not visible and Navigations are not
working fine :(

NOTE: POSTMESSAGE() is used only for user coded wndproc() methods still
SENDMESSAGE()exists.

IMPORTANT NOTE is all these problems are due to the Utility Library
Rebar --WndProc() handles issue. if we use the new toolstrip from VS
2005 these problems doesnot exists.

There is a necessity with Utility library Rebar --WndProc() --i want
to solve this issue

Please suggest...

*** Sent via Developersdex http://www.developersdex.com ***

Feb 14 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
4
by: garth | last post by:
When I running my program in ste-by-step mode I get his error message, it does not seem to apply when running in stand alone mode. What is the best to debug this error message? ...
0
by: Jesper | last post by:
Hi, In a single-threaded app I'm getting a ContextSwitchDeadlock MDA everytime I debug the app - in fact - I cant debug my app as I'm iterrupted by this funtionality before I can locate any...
1
by: Waldy | last post by:
Hi there, every time I try stepping through C# projects in VS 2005, I am plagued by the ContextSwitchDeadlock error messages. Is there any way of avoiding this?
2
by: Connie | last post by:
Dear All, If i step over my visual basic 2005 code, i got this error: The CLR has been unable to transition from COM context 0x1a2008 to COM context 0x1a2178 for 60 seconds. The thread that...
2
by: =?Utf-8?B?Z3V5?= | last post by:
XP box running a Win 2k3 server in a virual PC for CRM development... Intermittently (once a day ish) when single stepping I get the following exception:- The CL context 0x1a19d8 has been...
1
by: =?Utf-8?B?SkI=?= | last post by:
Hello As I debug the C# code with a break point and by pressing F11 I eventually get a message stating: ContextSwitchDeadlock was detected Message: The CLR has been unable to transition from...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.