A Loop of Nested Exceptions

Monday, November 17, 2014

It was a pretty incredible coincidence. Only a few days apart, I had to tackle two problems that had to do with nested exception handlers. Specifically, an infinite loop of nested exceptions that led to a stack overflow. And that's a pretty fatal combination. A stack overflow is an extremely nasty error to debug; a nested exception means the exception handler encountered an exception, which can't be pretty; and to add insult to injury, a stack corruption was also involved behind the scenes. Read on to learn some more about the trickiness of diagnosing nested exceptions and what can...
no comments

Making .NET Applications Faster: My Pluralsight Courses

Friday, November 14, 2014

I can't believe I waited until now to blog about it, but I have two courses on Pluralsight covering .NET performance optimization. If you've been reading this blog for any time now, you know this is one of my favorite topics -- and I was absolutely thrilled to join the Pluralsight author team in early 2014. My first course is titled Making .NET Applications Faster, and it was released in May. It's a fairly short course, running just under 2 hours, that covers the basics of .NET performance optimization. Some of my favorite topics include implementing value types correctly, using NGen...

Why Lug a Laptop When an iPad Is More Than Enough

Tuesday, November 4, 2014

I don't go to conferences as an attendee as much as I used to, and that means I'm losing my organization skills at what to bring when I'm going to attend sessions all day. Theoretically, you need a laptop and a tablet and a phone and a bunch of cables and chargers and external battery packs and connectors and adapters -- how else could you survive a full day packed with sessions and do some urgent work to put out fires if necessary? Turns out, I can pretty much do everything I need on my iPad, if I'm willing...
tags: ,
no comments

TechEd Europe 2014: Mastering IntelliTrace in Development and Production

Monday, October 27, 2014

I'm flying to TechEd Europe tomorrow, and decided to run an experiment and post my slides and demos before the session. Why the weird timing? Well, after giving the schedule a cursory glance, there are so many great sessions! It's really hard to pick a session based on the short conference abstracts, and I wouldn't want anyone to come to my session if they aren't absolutely sure it's a topic they care about. My talk is titled Mastering IntelliTrace in Development and Production. I love IntelliTrace and use it a lot, but it still remains a fairly obscure Visual Studio...
no comments

Talks from Software Architect 2014: Xamarin, Mobile Backends, and Swift

Friday, October 17, 2014

I'm sitting in the Lufthansa lounge at Heathrow Terminal 2 after another great conference in London. Software Architect (from the organizers of DevWeek) has just concluded, and I had the pleasure of delivering three talks on areas I am very excited about, all related to mobile application development. If you attended my talks, you'll find the following materials helpful; otherwise, stay tuned for the session videos that should be posted in a few weeks. Modern Backends for Mobile Apps Slides This session focused on Microsoft Azure Mobile Services and Facebook Parse, two strong competitors in the field of mobile app backends. Both...
no comments

DevConnections 2014: IntelliTrace, Diagnostics Hub, and .NET Production Debugging

Saturday, September 20, 2014

I'm flying back home from DevConnections 2014, which was great! Vegas was hot and dry as usual, but I actually managed to carve out some time in my schedule to see KA, which was really nice. (Plus, the conference was at the Aria resort, which is located smack in the middle of the strip, and is overall much nicer than Mandalay Bay where we were last year. I really liked the hotel room automation control. For example, I had an alarm clock set up to open the curtains, turn on the TV to a quiet music channel, and even...
no comments

Marshaling .NET and STL Collections in C++/CLI

Monday, August 25, 2014

When working with C++/CLI, you often have to convert C++ types to CLR types and vice versa. This most commonly happens with strings, but custom types and collections are just as painful. Visual C++ ships with a marshaling library in the msclr::interop namespace, which focuses on marshaling strings. However, it is notably lacking in the ability to marshal collections -- so you're left to your own devices if you have a std::map<std::string, std::vector<double>> that you need to mash into a .NET Dictionary<string, List<double>>. My wife and I spent a weekend writing a template library that marshals .NET and STL collections....
tags: ,
one comment

C++ Sink Parameter Passing

Thursday, August 21, 2014

C++ is the most complex language I know, and its parameter passing rules are only getting more arcane now that we have rvalue references in C++ 11. In this post I'd like to examine the specific scenario of passing parameters to a sink method, which consumes its parameters. What do I mean by "consume"? If a parameter is movable and safe to move from (i.e. it's an rvalue), it should move from it; if a parameter is only copyable, it should copy it. Here are a couple of sink methods from the C++ Standard Library: std::vector's push_back method will move from...

Make Move Constructors No-Throw

Friday, August 8, 2014

tl;dr: It's extremely important to make sure that your move constructor is no-throw and that it's marked noexcept. If you rely on the compiler-generated move constructor, you're good to go. Otherwise, read on.There is an important category of functions in C++ that are not allowed to throw exceptions. You should never allow an exception to escape from a destructor. If your destructor ends up throwing an exception, you will eventually get to a situation where your program's state is indeterminate and all you can do is exit the process. For example, if your destructor throws as part of an...
tags: ,
no comments

A Motivating Example of WinDbg Scripting for .NET Developers

Tuesday, August 5, 2014

WinDbg scripting gets a pretty bad name -- its somewhat contrived syntax, weird limitations, and hard to decipher expressions being the common culprits. In some cases, however, WinDbg scripts can be a very effective and reliable tool for extracting information from memory and processing it in a meaningful way. This post offers a simple example that hopefully will be useful as you begin to explore WinDbg scripts. For a more thorough explanation and more complex scripts, make sure to check my past posts on traversing std::vector and std::map. Let's set the stage with a simple console application that creates a number...