Skip to content

Commit d09a861

Browse files
committed
Adding a comment about the use of DispatcherSynchronizationContext
I'm reading this code, and it took me a few moments to understand what this code did. I've added a comment, pointing to the original post by Stephen Toub, explaining how to leverage the WPF dispatcher for this purpose.
1 parent 4f36e4c commit d09a861

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

StyleCop.Analyzers/StyleCopTester/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ private static void Main(string[] args)
3939
cts.Cancel();
4040
};
4141

42+
// The following allows continuations to be processed by a single thread.
43+
// Since Console apps do not have a SyncronizationContext, we're leveraging the built-in support
44+
// in WPF to pump the messages via the Dispatcher.
45+
// See http://blogs.msdn.com/b/pfxteam/archive/2012/01/21/10259307.aspx for additional details.
4246
SynchronizationContext previousContext = SynchronizationContext.Current;
4347
try
4448
{

0 commit comments

Comments
 (0)