It has been very long since my last post here – I was really busy at work. But I will try to “fix it”! :)
I don’t know where Sacha Barber finds time for all his articles and “hobby” projects, but I am glad he does! One of the latest subjects of his investigations is Task Parallel Library (or TPL in short), one of the new parts of .NET 4:
- Part 1: Starting Tasks / Trigger Operations / Exception Handling / Cancelling / UI Synchronization
- Part 2: Continuations / Cancelling Chained Tasks
- Part 3: Parallel For / Custom Partioner / Aggregate Operations
- Part 4: Parallel LINQ
- Part 5: Pipelines
- Part 6: Advanced Scenarios / v.Next for Tasks
I had a problem debugging my solution consisting of C#, C++/CLI, and native C++ projects. I was not able to get breakpoints working in the native C++ parts – after running the solution with breakpoints set, they were turning gray with warning sign, and their tooltip stated that “The breakpoint will not currently be hit. No symbols have been loaded for this document.” despite all debug properties were set right on those projects and all debugging symbols existed. After fighting it for a few hours and almost giving up, I started to think that the problem might not be with the native C++ projects, but rather somewhere else, e.g. in the StartUp project, which is C#. Checked that project’s properties, and guess what! Debug > Enable unmanged code debugging option was off!!! Switched it on, and voila – breakpoints work fine in native C++ DLL now!!! :)
There are three Microsoft hotfixes (967328, 967634, and 981107) that address WPF memory and resource leaks in .NET 3.5 SP1. Two of them are included in .NET 4, but 981107 is not and it is not clear when it will be available for it.
In VS2010, when the Data Sources Window is used to generate the UI, the generated XAML injects design-time information so that the Binding Builder can be used to create bindings for the UI controls. But if your application was written in Visual Studio 2005 or 2008, or you used the XAML Editor, the Designer or Expression Blend without the Data Sources Window, your coding style is to assign the DataContext in code and not data bind to CollectionViewSources in your XAML, then you won’t be able to take advantage of the new Binding Builder. How to Enable Using the Binding Builder in WPF and Silverlight Applications by Karl Shifflett to the rescue – it demonstrates the simple requirements to enable you to use the new Binding Builder in a variety of scenarios like the ones mentioned above.
Interesting (though useless) undocumented C# keywords (and corresponding IL instructions) described in Calling printf from C# – The tale of the hidden __arglist keyword on Bart De Smet’s B# .NET Blog.
Joseph Albahari, the author of C# 3.0 in a Nutshell, C# 3.0 Pocket Reference, and LINQ Pocket Reference as well as LINQPad, has very nice Threading in C# article (well, it is 77 pages long and available in PDF format as well). As the author says, “[it] tackles difficult issues such as thread safety, when to use Abort, Wait Handles vs Wait and Pulse, the implications of Apartment Threading in Windows Forms, using Thread Pooling, Synchronization Contexts, Memory Barriers and non-blocking synchronization constructs.”