Propagating a Transaction Across AppDomains

April 30, 2010

Earlier this week I had to propagate a System.Transactions transaction across .NET AppDomains. If you use a TransactionScope and rely on the ambient transaction propagation, you’ll find that the transaction does not cross the AppDomain boundary. This actually makes sense from an isolation perspective—transactions represent an isolation boundary and have their own failure semantics, while AppDomains represent another isolation boundary and have other failure semantics. There are several ways to propagate a transaction across AppDomains, but bear in mind that regardless of the method you choose, the transaction will be promoted to a distributed transaction when it flows...
2 comments

Pure Virtual Function Call: Repro Code

A few days ago I demonstrated a debugging scenario where one thread attempts to call a virtual function on an object whose destructor is running on another thread. The base destructor restores the virtual function table to that of the base class, which causes the other thread to call a pure virtual function. The code that I used to reproduce this scenario is really simple, but it’s not (at least for me :-)) immediately evident from reading it that this bug is lurking in the shadows. Here’s the code, anyway: #include ...
tags: ,
one comment

Unit Test Runs Stale Code Because Code Coverage Is Enabled in Visual Studio

April 28, 2010

A quick post to (maybe) save some of you some troubleshooting time one day. Executive summary: If your Visual Studio unit tests work when a debugger is attached and fail when there’s no debugger attached, make sure that the test is running the latest version of your code, and if it’s not, try turning off code coverage in your test run configuration. During the last two weeks I wasted at least an accumulated 5 hours trying to understand why my Visual Studio unit tests fail even after I fixed the bug. In particular, I couldn’t wrap my...
one comment

Pure Virtual Function Call (Destructor Madness)

April 27, 2010

How badly, on a scale of 1 to 10, do you like this error message? Not the friendliest one to see, I bet, when you’re trying to make your way through a day without calling any pure virtual functions… Well, a pure virtual function call is not a rare thing to see in the C++ world, and there are numerous reasons for something like this to happen, not the least of which being calling a pure virtual method from the base class’ constructor. In this post we’re going to see something slightly less traditional. Let’s...
tags: ,
2 comments

My MCT Virtual Summit 2010 Sessions Are Publicly Available

April 19, 2010

A few days ago I wrote about my sessions at the MCT Virtual Summit 2010. The session recordings have been made publicly available using LiveMeeting, so even if you didn’t attend the conference you can tune it at: 50150 and 50166: C# 3.0, Programming the .NET Framework 3.5 and a glimpse towards Parallel Programming in Visual Studio 2010 50153: .NET Performance When clicking the links, enter your name and leave the recording key field blank, for example: Next, fill in your email address and company name,...
tags:
no comments

“Introduction to Windows Shell” inside “Introducing Windows 7 for Developers”

April 17, 2010

Our book, Introducing Windows 7 for Developers, has quite a few pages on how to interact with the Windows 7 Taskbar and Libraries using the Windows Shell interfaces. Unfortunately, the section that introduces the Windows Shell and lists the primary shell COM interfaces has ended up on page 89, in the Libraries chapter (Chapter 4), even though it’s cross-referenced elsewhere as if it appears in Chapter 1. (I noticed the omission thanks to this review.) If you were looking for that section to brush up your Windows Shell programming skills, it’s right there on page 89, titled...
tags:
no comments

Perceived Response Time from a Developer’s Perspective

April 16, 2010

One of the most cited usability problems is when the actual implementation response time is very different from the perceived and expected response time. In most cases, the implementation response time is slower than expected. Yesterday I had an interesting observation to the contrary. As a developer, I understand what the “actual” implementation response time should be, because I understand the runtime complexity of an operation and can bring into consideration other factors such as network latency and server load. On the other hand, the “average user’s” perceived response time might be significantly lower or higher than the...
one comment

Windows 7 How-To Videos: Libraries and Federated Search

April 14, 2010

More Windows 7 videos that I recorded have been posted on Channel 9. This installment deals with Windows 7 shell libraries and Federated Search, a subject that I haven’t covered in depth on my blog. The videos feature an introduction to shell libraries and demonstrate how to integrate your application with Windows 7 libraries from managed and native code, how to register for library change notifications (if you care about changes to library contents), and how to use Federated Search to integrate your search provider into Windows Explorer. [I don’t remember if I told you this in my...
no comments

Yet Another Way to Determine the Sync Object for Which Your Thread Is Waiting

A couple of years ago I gave a cursory visit to the subject of diagnosing a Monitor-based deadlock in a managed application, and then a few months ago I demonstrated in greater detail how to locate the synchronization object your thread is waiting for using SOS. [Side note: It’s always easy to see the list of currently owned Monitors (sync blocks) using the SOS !SyncBlk command, which also tells you which thread owns each synchronization object. The hard part is to find the synchronization object for which your thread is waiting if you don’t have any prior knowledge...
tags:
no comments

My Session from the MCT Virtual Summit 2010

April 11, 2010

On Friday I presented two sessions at the MCT Virtual Summit 2010, a Microsoft event for Microsoft Certified Trainers and Educators. Both sessions were train-the-trainer presentations for the courses Sela has in the Microsoft Courseware Library, but I decided to spice things up a little bit by adding a couple of demos to each of them. The first session was about the Sela courses 50150 and 50166—C# 3.0 and Programming the .NET Framework 3.5—as well as an introduction to Parallel Programming with Visual Studio 2010 and .NET 4.0. I showed a couple of demos from...
tags:
no comments