This is part 4 in a series on using Task Parallel Library when writing server applications, especially ASP.NET MVC and ASP.NET Web API applications.
- Introduction
- SynchronizationContext
- ContinueWith
- TaskHelpers
Simple Task Helpers
I know we left off in part 3 with a problem, but we're not going to solve it yet, because we still need to build some foundation helper classes that will make it easier to do that. In particular, there are some good practices we can codify around the creation and conversion of tasks that led us to write the TaskHelpers class that we use today in ASP.NET Web Stack.
Continue reading "Task Parallel Library and Servers, Part 4: TaskHelpers" »
This is part 3 in a series on using Task Parallel Library when writing server applications, especially ASP.NET MVC and ASP.NET Web API applications.
- Introduction
- SynchronizationContext
- ContinueWith
- TaskHelpers
What ContinueWith Really Does
I promised that we had a bug in our previous code, and we did... sort of. Calling ContinueWith without any special flags will cause your continuation to always run, regardless of the final state of the task. We wrote our continuation under the assumption that the Task had completed successfully, which can lead to some very odd and hard to debug problems. Luckily, in our code, we ended up calling Result on the Task object, which turns around and throws an exception if the task had ended in a faulted or canceled state. But what if we'd had a Task rather than a Task<T>? Or what if we hadn't called Result? In .NET 4, this is considered a fatal error condition, and when the task object got garbage collected, its finalizer would've thrown an exception that takes down your AppDomain because you had an unobserved fault! Definitely not good.
Continue reading "Task Parallel Library and Servers, Part 3: ContinueWith" »
This is part 2 in a series on using Task Parallel Library when writing server applications, especially ASP.NET MVC and ASP.NET Web API applications.
- Introduction
- SynchronizationContext
- ContinueWith
- TaskHelpers
Introduction to SynchronizationContext
An important part of the work in properly handling tasks on the server is supporting the synchronization context. When you’re using .NET 4.5, then the await keyword automatically does this for you. When you’re consuming Task objects on .NET 4, though, getting yourself back onto the right synchronization context is critical; otherwise, you may cause errors in your application when trying to access things which touch the HttpContext in ASP.NET.
Continue reading "Task Parallel Library and Servers, Part 2: SynchronizationContext" »
This is part 1 in a series on using Task Parallel Library when writing server applications, especially ASP.NET MVC and ASP.NET Web API applications.
- Introduction
- SynchronizationContext
- ContinueWith
- TaskHelpers
Okay, let’s just get this out of the way:
Asynchronous (multi-threaded) programming is not easy.
This warning really has nothing to do with .NET in particular, because it can be quite challenging to do correctly on any framework, but here’s the good news:
Asynchronous programming with .NET 4 is a little easier.
Asynchronous programming with .NET 4.5 is a lot easier.
Continue reading "Task Parallel Library and Servers, Part 1: Introduction" »
This is an update to my previous post about running Windows 8 Developer Preview on the Samsung Series 7 Slate. Until we get Windows 8 logo'd hardware, I believe this to be the best developer device for doing early explorations into Windows 8 development on.
That said, this is still beta-level software. Tread carefully. :)
Continue reading "Windows 8 Consumer Preview on Samsung Series 7 Slate" »
On January 2nd, Jim and I shipped xUnit.net 1.9. We updated NuGet with the 1.9 build binaries, and for the first time, we're including the MSBuild runner inside the "xunit" NuGet package.
There are a few big new features that are worth calling out.
Continue reading "Shipped: xUnit.net 1.9" »
Today, I installed Hyper-V on my Windows 8 machine so I could make a VM for a demo I'm giving later this week. I set up the virtual network as an internal network, and then used Windows 8's internal bridging system to bridge the internal network over to the live WiFi.
DISCLAIMER: You're about to mess with registry settings and network settings. You could seriously break things if you do it wrong, and there's no guarantee I've done everything right. Make sure you have a backup before doing anything like this.
Continue reading "Making Hyper-V Internal Network Private" »
Update: Visual Studio 11 Beta is now available to the public. We've released the runner for xUnit.net for VS11 Beta in the Extension Gallery.
Update: Visual Studio 11 Developer Preview is now available to the public.
Earlier this week at the //build/ windows conference, Jason Zander announced the availability of a new "developer-focused" unit test runner in Visual Studio 11. They shipped the first Developer Preview of Visual Studio 11, and it includes this new unit test runner. Peter Provost demonstrated the pluggability of this new unit test runner by showing (and writing) tests written in xUnit.net. We collaborated with Peter and wrote the prototype runner that he used on stage during his demos.
Continue reading "Prototype xUnit.net Visual Studio 11 Unit Testing Plugin" »