Click here to Skip to main content
15,887,485 members
Home / Discussions / WPF
   

WPF

 
QuestionGrid.ColumnDefinition.setvalue Pin
caradri28-Nov-12 3:06
caradri28-Nov-12 3:06 
AnswerRe: Grid.ColumnDefinition.setvalue Pin
Matt T Heffron28-Nov-12 9:05
professionalMatt T Heffron28-Nov-12 9:05 
GeneralRe: Grid.ColumnDefinition.setvalue Pin
caradri28-Nov-12 20:12
caradri28-Nov-12 20:12 
QuestionGrid Pin
Ehsan Mashkouty28-Nov-12 0:01
Ehsan Mashkouty28-Nov-12 0:01 
QuestionSet Backgroundcolor when CheckBox in TreeView is checked Pin
Member 963452827-Nov-12 23:43
Member 963452827-Nov-12 23:43 
QuestionWPF Grid Splitter Problem Pin
Kevin Marois27-Nov-12 16:27
professionalKevin Marois27-Nov-12 16:27 
QuestionWPF Dispatch.Invoke/BeginInvoke deadlock? Pin
devvvy26-Nov-12 19:30
devvvy26-Nov-12 19:30 
Answer[SOLN FOUND] - it is NOT that Dispatcher.Invoke buggy! Pin
devvvy29-Nov-12 14:15
devvvy29-Nov-12 14:15 
Found the answer, share it here to dispel myth Dispatcher.Invoke buggy...

thread A background thread
<br />
lock(SomeSingleton)<br />
{<br />
   LoadItems(..) --> This will trigger event "ItemsReloaded", and one UI thread handler handles this. Problem is, "SaveItems" button clicked after initial lock to SomeSingleton but before "ItemsReloaded" fired.<br />
}<br />


UI Thread handler for "ItemsLoaded":
<br />
...<br />
ItemsGrid.Dispatcher.Invoke(                           System.Windows.Threading.DispatcherPriority.Background,<br />
                              new Action(<br />
                                delegate()<br />
                                {<br />
                                     // Holds no lock statement here!!!<br />
                                     // But Dispatcher.Invoke is blocked by thread B (UI thread) indefinitely - see next...<br />
                                }<br />
...<br />


Thread B (UI Thread)

void btnItemsSaved_Clicked(...)
{
lock(SomeSingleton) // Block by thread A, thus hanging UI thread.
{
// blocked indefinitely as Thread A cannot return until "ItemsLoaded" (thus its UI handler) is fired.
}

return;
}


Hope it helps.

What's INTERESTING though, is Windbg pointed me to lock statement in THREAD-A, whereas, if I attached Visual Studio debugger (with Intellitrace), it lead me straight to lock statement in THREAD-B

Also, in this situation, there's only one "SingletonLock" - not the textbox deadlock situation where you have lock(LockA) and lock(LockB) with two threads locking in reverse order.
dev


modified 29-Nov-12 20:23pm.

GeneralRe: [SOLN FOUND] - it is NOT that Dispatcher.Invoke buggy! Pin
Paulo Zemek23-Jan-13 6:41
mvaPaulo Zemek23-Jan-13 6:41 
QuestionChange [EnableClientAccess(RequiresSecureEndpoint = true)] based on config Pin
Adam_Dev20-Nov-12 22:34
Adam_Dev20-Nov-12 22:34 
QuestionCommand Binding Pin
Andy_L_J19-Nov-12 10:51
Andy_L_J19-Nov-12 10:51 
AnswerRe: Command Binding Pin
SledgeHammer0119-Nov-12 11:14
SledgeHammer0119-Nov-12 11:14 
GeneralRe: Command Binding Pin
Andy_L_J19-Nov-12 11:36
Andy_L_J19-Nov-12 11:36 
GeneralRe: Command Binding Pin
Mycroft Holmes19-Nov-12 11:51
professionalMycroft Holmes19-Nov-12 11:51 
GeneralRe: Command Binding Pin
Andy_L_J19-Nov-12 12:14
Andy_L_J19-Nov-12 12:14 
GeneralRe: Command Binding Pin
Mycroft Holmes19-Nov-12 13:22
professionalMycroft Holmes19-Nov-12 13:22 
GeneralRe: Command Binding Pin
SledgeHammer0119-Nov-12 12:14
SledgeHammer0119-Nov-12 12:14 
GeneralRe: Command Binding Pin
Mycroft Holmes19-Nov-12 13:26
professionalMycroft Holmes19-Nov-12 13:26 
GeneralRe: Command Binding Pin
Wayne Gaylard20-Nov-12 3:29
professionalWayne Gaylard20-Nov-12 3:29 
GeneralRe: Command Binding Pin
SledgeHammer0120-Nov-12 6:42
SledgeHammer0120-Nov-12 6:42 
AnswerRe: Command Binding Pin
Pete O'Hanlon22-Nov-12 22:41
mvePete O'Hanlon22-Nov-12 22:41 
GeneralRe: Command Binding Pin
Andy_L_J23-Nov-12 1:48
Andy_L_J23-Nov-12 1:48 
QuestionWPF Components For WinForm Pin
alirezamansoori13-Nov-12 5:26
alirezamansoori13-Nov-12 5:26 
AnswerRe: WPF Components For WinForm Pin
Pete O'Hanlon13-Nov-12 7:56
mvePete O'Hanlon13-Nov-12 7:56 
AnswerRe: WPF Components For WinForm Pin
Abhinav S13-Nov-12 21:17
Abhinav S13-Nov-12 21:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.