Post Categories

Programming

October 2014 Entries

Although there was no part one my other post "Can You Execute Code While Waiting For A Lock?" can be considered as part one. I hope that this will not become a larger series where code is executed in the wrong order. Suppose you want to execute the commands Init Action OtherAction Dispose Shutdown in this order on the UI thread of an application from another thread. Then you would do something like this: using System; using System.Diagnostics; using System.Threading; using System.Windows.Forms; namespace ......

Threading can sometimes lead to impossible bugs where you have a hard time to find out how you got into this state. Lets suppose you have a nice WPF application which you dutifully test via the UIAutomation provider which can alter some state in your application. /// <summary> /// Interaction logic for TestWindow.xaml /// </summary> public partial class TestWindow : Window { int Data; public TestWindow() { InitializeComponent(); } public void AlterData(int newValue) { Debug.Print("Executing ......