Microsoft DevLabs

On the DevLabs site you read: “Any truly remarkable software innovation that introduces a paradigm shift is based on solid inventive ideas. But it also needs discussion, trial, collaboration, and a critical eye. Explore the projects that we are experimenting with in our labs, and let us know if they inspire you.”

Currently there are four projects there:

  • Popfly, a “fun, easy way to build and share mashups, gadgets, games, Web pages, and applications”
  • Small Basic, a “simple and easy programming language with a friendly environment that provides a cool and fun way of learning programming”
  • Pex, an “intelligent assistant to the programmer”
  • CHESS, a “concurrency testing tool for finding and reproducing concurrency Heisenbugs in your code. CHESS can find assertion violations, deadlocks, livelocks, data-races, and memory-model errors. CHESS works both for managed and for unmanaged code”

API Hooking

Detours is a Microsoft library for instrumenting arbitrary Win32 functions (by Microsoft Research), unfortunately not free. There is a paper Detours: Binary Interception of Win32 Functions by Microsoft guys. In addition, there is API Hooking with MS Detours article on CodeProject.

Then, there is EasyHook“The reinvention of Windows API Hooking” as they say themselves – which allows to hook APIs from managed code and write managed detours. This one is free, and from what is there it looks even more interesting than Microsoft’s Detour. And there is also a related CodeProject article.

Garbage Collection in .NET

Still in 2000, Jeffrey Richter wrote a two-part article for MSDN Magazine titled “Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework” (part 1, part 2). I am not sure here, but I guess that not that much has changed in the principles of garbage collector’s inner workings since then, so this article, despite being oldish, is giving a good idea about what is happening during garbage collections and why.

LINQPad

LINQPad is a free LINQ editor allowing interactive querying of SQL databases using LINQ, and much more, e.g. it supports LINQ to Objects, and LINQ to XML; in addition, it can execute any C# 3 or VB 9 expression or statement block.

Problem Showing Document Properties in Word 2007

Instead of showing the document properties, my Word 2007 was showing nice “The Document Information Panel was unable to load” message when I was invoking Prepare > Properties. Finally I got tired of this and decided to do something about it. Found two solutions on the Internet.

One was to disable System Event Notification service, and, of course, it was not working (I would wonder if it would, as I do not see any link between SENS and document properties).

The other one was a bit more elaborate. It argued, that the missing “%ProgramFiles%\Microsoft Office\Office12\1033\ipedintl.dll” is causing the issue, and copying this file into the abovementioned location would restore Word’s functionality. The file was missing in my case; I found it in “%ProgramFiles%\Microsoft Web Designer Tools\Office12\1033\”, copied it over to “%ProgramFiles%\Microsoft Office\Office12\1033\”, and voilaz, Word now shows the document properties panel fine.

UPDATE I had to reinstall my PC. So, fresh Windows XP SP3 and fresh Office 2007 with SP1 – same problem appeared straight after the installation :) . Really sucks (but at least now I knew how to fix it!)

UPDATE 2 I had to reinstall my work PC now, and again the same shit, except now I used Office 2007 Ultimate SP1. But now there was a twist – ipedintl.dll was nowhere on the hard disk… I found it on Office installation disk in the “\Office.en-us\OfficeLR.cab” file (.cab is an archive file, like .zip or .7z or similar). It is called IPEDINTL.DLL_1033, and you should extract it to the above mentioned “%ProgramFiles%\Microsoft Office\Office12\1033\” directory (using e.g. 7-zip) and rename it to ipedintl.dll. Problem fixed.

Transactional Memory

There is a team at the Microsoft’s Parallel Computing Platform group (guys behind the Parallel Extentions for .NET) that is implementing an experimental transactional memory system in .NET. Recently they have put up a Transactional Memory blog – let’s hope that it will get more than one entry eventually :) .

While Microsoft still ponders about the thing, Ralf W created the NSTM – .NET Software Transactional Memory project on CodePlex. Additionaly, he has a set of articles on his Ralf’s Sudelbücher blog about this project and its implementation.

|=uCl<1/\/9 Acrobat Reader!!!

Arghhhhh! The newest Acrobat Reader sucks big time!!! Its Content Preparation Progress/Please wait while the document is being prepared for reading dialog is something beyond my understanding. It is “processing” the document with the speed of 1-2/pages per second, and stays on top of e.g. browser; plus, you cannot do anything with the document while the dialog is there, e.g. no searching.

How could older Acrobat Readers show me my documents without displaying this beautiful piece of “contemporary PC art”, and the newest reader cannot!?

UPDATE There is a way to turn it off! There is the Reading > Screen Reader Options > Page vs Document option in Preferences, and it should be set to Only read the currently visible pages. No idea, why it had different value, as I have never touched it. Anyway, I am not alone in this – many others had the same issue, when this setting got somehow changed.

Problem with C++/CLI + ATL Combo

Exactly… Wanted to use ATL (for CComPtr class and some other things) in my C++/CLI project (VS2008 with or without SP1) and… got nice assert on _CrtIsValidHeapPointer(pUserData) in dbgheap.c. Cool! Exactly that was missing to make my day better!

Some investigation, and I had answer to my problem. Actually two answers. Both pretty simple:

  1. As I had /NOENTRY specified in the No Entry Point item in the Linker/Advanced section of the project settings, I could add __DllMainCRTStartup@12 to the Force Symbol References item in the Linker/Input section of the project settings
  2. Alternatively, I could set No Entry Point item in the Linker/Advanced section of the project settings to No (as I said, I had /NOENTRY there)

I have tried both solutions, and both worked; I settled on the latter as more intuitive and clean. Always live, always learn…

Appropriate Use of Type Inference or (2 var | ! 2 var)

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…

Expression Blend 2 SP1 RC Preview

Had no time to blog – work really takes all my time nowadays (and “nowanights” too :)…

Microsoft has finally released a newer version of Expression Blend. Now it is called Expression Blend 2 SP1 Preview or Expression Blend 2 SP1 RC Preview, depending on where on Microsoft’s site you are reading it, hinting that we will likely get the final release version rather sooner than later (in a month or two, who knows?). This is the version that marks the end of Expression Blend 2.5 CTP – Microsoft will not release newer versions of 2.5 CTP anymore; instead, all 2.5 features migrated to Blend 2 SP1, which is not bad IMHO.

I had not much time to play with it so far, but what I have seen looks really promising. For example, Blend finally stopped crashing all the time in case there were errors in XAMLs (or rather in code-behind); now it is displaying meaningful error messages about these problems, so you finally get a chance to fix it. Of course, there are still many problems which Microsoft most likely will not fix in this release anymore. For example, the Resources pane really sucks big time: if you have many resource files (and you have them if you are skinning your app), it is virtually impossible to navigate in them – they are sorted in weird order known only to Microsoft itself (or, maybe, it is just random?), and there is no way to do anything about it, e.g. sort them in alpha order.

In any case, it is really big step in the right direction. I would recommend to move to 2.0 SP1 ASAP in case you are using 2.5 CTP and developing WPF applications (cannot say about Silverlight/Silverlight 2 as I am not using those).