Programming Rants

Your options for async LINQ are very limited (c)
15 May 2015
CodeProject Simply put, async and LINQ don’t coexist very well. With “async all the way” approach, LINQ queries have to be unwound back into loops. Frankly, that’s a shame. http://stackoverflow.com/questions/16866331/convert-async-loop-to-linq-query

How to break into debugger when specific Windows message is sent or posted
14 May 2015
CodeProject We have recently been fighting a weird problem in our .NET application that was caused by a duplicate WM_KEYDOWN message. It relatively is easy to figure out who receives the message (Spy++ helps a lot), but how to find out who sends it? If you know (or suspect) the process that sends your message, […]

Why identifiers with non-English letters are bad for your health
29 Apr 2015
We just ran into a very funny story with UNICODE identifiers in C#. It turned out that an identifier like ХTranfer was spelled with Russian letter Х (U+0425) instead of Latin X (U+0058). Furthermore, when we tried to build this code on the server, it complained that identifier ÕTransfer was not found. It turns out […]

Windows Store Bundles Blunders
22 Apr 2015
Long, very technical story, interesting only to Windows Store programmers. Recording this mostly to document the experience. Scenario 1. We have a universal app that contains a Windows Store and a Windows Phone project for Windows 8.1. 2. I manually generated packages for both projects in Visual Studio 2013 Update 4. 3. Visual studio changed […]

Async/await: to sum it up
12 Apr 2015
async methods are not executed asynchronously: see Async/await FAQ, Does using the “async” keyword on a method force all invocations of that method to be asynchronous?). await task is not the same as task.Wait(): ibid, Is “await task;” the same thing as “task.Wait()”?. ExecuteSynchronously() may not actually execute synchronously. TaskScheduler.Current may be and frequently is […]

How “async void” actually works
29 Mar 2015
Let’s say I have this code (C#): void SomeFunc() { HandlerOne(); HandlerTwo(); } async void HandlerOne() { DoX(); await DoYAsync(); DoZ(); } In this case HandlerOne() will return to the calling functions the moment it hits its first await. The code is roughly equivalent to: void HandlerOne() { DoX(); Task t= DoYAsync(); t.ContinueWith(task=>DoZ()); } So, […]

Windows Azure: “user friendly” copy utility
25 Feb 2015
Story in a nutshell: I wanted to copy a huge Azure blob from one place to another. Since there are no convenient Azure management tools from Microsoft*, I used command line AzCopy utility. A minute or two into the process, I realized that a) The speed ain’t that great and the copy will take several […]

Windows Store Apps: Back to DLL Hell
04 Feb 2015
I was recently tasked with creating a Windows Store (Metro, WinRT) version of an existing app. This is my first WinRT project. Documenting my experience so far: 1. So called “universal apps” are not truly universal. They actually consist of several platform-specific projects that may share some code. There is no true binary or even […]

MySQL: you get what you’re paying for
22 Dec 2014
Long, long time ago in the galaxy not so far away I installed mySql 5.05 on my server. After some time I decided to upgrade to the current version, MySql 5.6. It turned out to be quite an ordeal. First of all, there is no easy upgrade path between different major versions of MySQL. Official […]

WPF user controls: do not use merged dictionaries for shared resources
24 Nov 2014
Resource dictionaries in WPF are not shared, unless they are part of App.xaml. That is, if you have a user control that loads (and uses) some resource dictionary, new instance of the dictionary will be loaded for each instance of the user control. This can (and does) lead to increased loading time and memory footprint. […]