synchronizationcontext Questions

2

Solved

I have been looking all over for an answer to this question, but can't seem to find a satisfactory answer. Maybe someone here can enlighten me. I have a descendent of BindingList<T> that sto...

1

Solved

What is a workaround for the issue where the SynchronizationContext.Current is null unexpectedly on the main thread in .NET 4.0? See: SynchronizationContext.Current is null in Continuation on th...

1

Solved

Would using Thread.CurrentPrincipal's claims in a referenced library that uses ConfigureAwait(false) pose any problems or will the flowing of ExecutionContext's logical call context take care of me...

1

Solved

I've got a couple ASP.Net MVC and WebAPI projects. Most of them are up to date (MVC 5 / WebAPI 2). I've been double-checking my security assumptions since I'm implementing a global filter (for MVC)...

1

Solved

This article from states that SynchronizationContext may flow with ExecutionContext: private void button1_Click(object sender, EventArgs e) { button1.Text = await Task.Run(async delegate { ...
Earpiercing asked 23/10, 2013 at 17:25

3

Solved

I am writing a multi player game server and am looking at ways the new C# async/await features can help me. The core of the server is a loop which updates all the actors in the game as fast as it c...

5

The Task Parallel Library is great and I've used it a lot in the past months. However, there's something really bothering me: the fact that TaskScheduler.Current is the default task scheduler, not ...

1

Solved

In previous versions of MonoTouch, I used to do this to ignore unobserved exceptions: TaskScheduler.UnobservedTaskException += delegate(object sender, UnobservedTaskExceptionEventArgs e) { Consol...
Esophagus asked 25/7, 2013 at 12:17

2

I am still learning the whole Task-concept and TPL. From my current understanding, the SynchronizationContext functions (if present) are used by await to dispatch the Task "somewhere". On the other...
Aldine asked 4/6, 2013 at 11:7

1

How do I compare SynchronizationContext? It seems that the same Dispatcher can create different SynchronizationContext when using BeginInvoke. When I drill down into the two (unequal) contexts, I s...
Lubeck asked 21/11, 2012 at 18:46

1

Solved

Having read the phrase "The current SynchronizationContext is a property of the current thread" correct", I am a little confused... In a C# app code in VS2010, when I type Thread.CurrentThread. I...

2

Solved

I do some tests with the new asynchronous pattern of C# 5.0 (async/await) I have a problem with understanding how the asynchronous methods are called. Considering this code : private async Task&l...

1

Solved

We are observing something strange, code like this: var task = new Task(...); // run in the background, do something lengthy work task.ContinueWith(..., TaskScheduler.FromCurrentSynchronizationCon...
Tarr asked 20/3, 2013 at 13:18

1

The Issue I have an ASP.NET 4.0 WebForms page with a simple web-service WebMethod. This method is serving as a synchronous wrapper to asynchronous / TPL code. The problem I'm facing, is that the i...

3

Solved

I have following code: [TestMethod] public void StartWorkInFirstThread() { if (SynchronizationContext.Current == null) SynchronizationContext.SetSynchronizationContext( new SynchronizationConte...
Smallish asked 8/10, 2010 at 16:24

1

Solved

I would like put the code first and then explain the situation and ask my question based on that: public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } pr...

1

Solved

I've been trying to track down the following issue in a Winforms application: The SynchronizationContext.Current is null in a task's continuation (i.e. .ContinueWith) which is run on the main threa...
Philipines asked 23/7, 2012 at 22:17

1

Solved

I have a winform application, and an observable set up like this: Form form = new Form(); Label lb = new Label(); form.Controls.Add(lb); Observable.Interval(TimeSpan.FromSeconds(1)) .Subscribe(l...
Kinesics asked 14/9, 2011 at 14:25

2

I'm learning about the SynchronizationContext class. I'm trying to understand what are the common usage scenarios for calling SynchronizationContext.SetSynchronizationContext() in the context of a ...
Symmetrize asked 11/1, 2011 at 14:46

1

I have a WPF application that is using System.Threading.Tasks to call a WCF service in the background. I'm using Task.ContinueWith to return the results of the service call to the WPF UI thread. My...
Mercantile asked 18/2, 2011 at 16:21

2

Solved

Note first of all that this question is not tagged winforms or wpf or anything else GUI-specific. This is intentional, as you will see shortly. Second, sorry if this question is somewhat long....

2

Can somebody tell me when to use a Dispatcher and when to use the SynchronizationContext class? For a while now I have been using the Dispatcher to queue up tasks from a background thread, then I ...
Cup asked 18/6, 2010 at 13:1

1

Solved

Thanks to Jeremy Miller's good work in Functional Programming For Everyday .NET Development, I have a working command executor that does everything I want it to (do heavy lifting on the thread pool...
Bachelorism asked 18/3, 2010 at 20:15

2

Solved

I'm using a SynchronizationContext to marshal events back to the UI thread from my DLL that does a lot of multi-threaded background tasks. I know the singleton pattern isn't a favorite, but I'm us...
Acrodrome asked 22/12, 2009 at 23:5

2

Solved

I just wrote this code: System.Threading.SynchronizationContext.Current.Post( state => DoUpdateInUIThread((Abc)state), abc); but System.Threading.SynchronizationContext.Current is null
Shipworm asked 10/11, 2009 at 17:6

© 2022 - 2024 — McMap. All rights reserved.