If you ever had “strange” problems with async/await, the Async in C# and F#: Asynchronous gotchas in C# might have an answer.
Pause ‘n’ play: Asynchronous C# Explained is a quite nice presentation from Microsoft Research’s Claudio Russo about asynchronous programming in C# 5.
I always, and I mean ALWAYS forget the syntax of RowFilter expressions. So, here is a nice round-up on the topic.
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!!! :)
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.”
- TomasP.Net blog by Tomas Petricek, author of Functional Programming for the Real World: With Examples in F# and C# (have not read this book yet, so no idea how good it is), features plenty of interesting information about functional programming in general, and in F# in particular.
Needed to do some “weird” things recently that involved bit operations, e.g. to create masks with certain number of bits set. During my “research” I found few interesting places:
- Bit Twiddling Hacks – lots of snippets related to bit operations, e.g. counting, reversing, swapping, interleaving, testing, etc., etc., etc.
- Creating multiple numbers with certain number of bits set – this was the answer to my need, clean and simple
- Technical Interview Questions – has a lot of interesting topics, nicely categorized, although not all-encompassing, if comparing to the first link above
Type inference is a new C# feature allowing one to declare variable in a type safe way, while “saving typing”. As it is a new feature, there are still going debates (sometimes heated) about appropriate uses of type inference. When to use Type Inference on jaredpar’s WebLog represents the “use it whenever it’s possible” camp, while Appropriate use of Local Variable Type Inference on B# .NET Blog (really nice blog indeed!) represents the “use it only when it’s absolutely clear what the type is” camp. My view coincides with that expressed in the latter article, i.e. “use it only when it’s absolutely clear what the type is”. Especially, one starts to value this approach in case one has to read the code written by someone else: it is sometimes (usually?) difficult to grasp what that code is doing, and then on top of that one has to figure out what are the actual types of variables. Brrrrrrr…
These are mostly related to systems’ programming:
- Professional System Library – a free, open-source COM library that offers a simple, generic and logical API for accessing most commonly used information about the system and the environment in which the client application is running, e.g. security, privileges, processes, threads, drivers, services, network, memory, etc. There is also Professional System Library: Introduction article at CodeProject giving brief introduction to the library.
- Authors of 32 OpenMP traps for C++ developers article did really good job. I have not use OpenMP (multi-platform shared-memory parallel programming API for C/C++ and Fortran) myself yet, but can easily imagine that this article can save many hours of painful digging into the non-working code.
- A Fiber Class (and Friends) (C++) is introducing fibers and illustrates the implementation of round-robin scheduler for fibers.
- Telling The Difference Between CD and DVD Drives (C++) – might save some time if needed eventually
- Using Raw Input from C# to handle multiple keyboards – despite the article is in C#, it is 1:1 translating to C++.
- Tracing Events Raised by Any C# Object presents the simple-but-general event hooking/tracing class.
- Luca Bolognese’s WebLog [MSFT] – C# mainly (e.g. a C# library to write functional code, creating an immutable value object in C#, LINQ, and other nice C# things)
- LukeH’s WebLog by Luke H? [MSFT] – interesting C# articles mostly, with some F#
- Charlie Calvert’s Community Blog [MSFT] – VS IDE and LINQ articles, some WPF, etc.
- Yet Another Language Geek by ??? – C# functional programming, advanced C# topics (e.g. partial methods, iterators), some other interesting stuff
- The Mellow Musings of Dr. T by ??? – C# functional programming (not updated though)
- Pedram Rezaei’s Ramblings – a bit of everything: Parallel Extensions for .NET, WCF, WPF…
- Fabulous Adventures In Coding by Eric Lippert [MSFT] – generics, advanced .NET topics, covariance vs contravariance, etc.
- Managed World blog by Jason Olson [MSFT?] – a lot of interesting information about new .NET things like lamdas, Managed Extensibility Framework, F#, etc.
- Ayende @ Rahien by Oren Eini – testing, mocks, a lot of code snippets (including Code of the Week), etc.
- Kirill Osenkov – QA, advanced C#, etc.
- Sree’s ventures in code space by ? – debugging, C#, extension methods, etc.
PostSharp is a free and open source aspect-oriented programming (AOP)/policy injection framework that can reduce the number of lines of code and improve its logical decoupling by allowing encapsulation of e.g. transaction management, logging, caching, or security aspects as custom attributes. Own custom attributes can be developed that will add new behaviors to code.