Wednesday, 1 August 2012

Becoming a Father: One Year On - Part 3


This is the third part of my retrospective on my first year as a new father. To view all the parts, please click on one of the links below:

Part 1 - The Beginning
Part 2 - The First Two Weeks
Part 4 - The Accident

This post focuses on...

Getting the Hang of Things

Once I became more accustomed to waking up several times in the night followed by waking up early in the morning to go to work each day, I came to realise that things do tend to settle into a routine (almost). My wife and I learned many things about our son in the first 6 months:

  1. He liked to be on the go all the time, he simply did not like sitting still much. This resulted in me usually having to administer some kind of silly walk whilst carrying him so he felt the exaggerated movement and which kept him happy. Although after 30 seconds of this around the living room my leg muscles would be screaming at me to stop.
  2. He also didn't think much of napping during the day. Whilst other parents might boast that their little angel would have a 1 - 2 hour nap in the afternoon, we were forced to endure almost a whole day of feeling exhausted and looking after him since he would sleep for at most 30 minutes at a time (with usually a 4 - 5 hour gap inbetween).
  3. The flip-side of not napping during the day though was that he at least seemed to understand the day-night cycle and would sleep longer and better during the night. My wife and I started off going to bed at around 8pm for at least 3 months because we simply couldn't stay awake any longer!
  4. He was heavy and I was weak. When he was born he weighed 8lb 11oz - which for those not in the know is fairly large - and he pretty much worked his way up to the 91st percentile of his baby contemporaries and was generally the largest of all his baby friends. I am not a physically strong person and having to carry him around started to get very draining, though I eventually got more used to it - perhaps it could have been considered as weight training for me!
  5. My wife tried feeding him expressed milk as breastfeeding did not go well but eventually he started to drink more and more formula milk to the point where he could, after a few months, drink almost an entire bottle of it every 3 hours. That could explain the weight gain...
  6. He got to a point 3 months in where he slept pretty much through the night - the holy grail of parenting! But then, at 4 months, he switched things around a bit and did the dreaded sleep regression. Why babies apparently do this I do not know. I was having dinner with some friends and boasting about how he slept through the night now at such a young age when I got a text message from my wife telling me that he started waking up at night; that was the night when he started waking up several times a night for the next few months. I resolved from then on to never discuss his sleeping habits with anyone other than my wife lest I somehow jinx everything.
  7. Most importantly though was that we could start to see that he had a personality. It is hard to describe in writing but there were little things he did that you could just tell were a part of him.

The Daily Routine

I found it incredibly helpful that a daily routine seemed to materialise over time - I am a programmer after all! My wife and I both agreed that I would do the (very) early morning feed as once I'm awake I tend to stay awake; I'm a very light sleeper. 

Once that was done and everyone was still asleep I could get to my morning chores which started about 6am. These involved having a shower and breakfast for me of course but also cleaning up all the milk bottles, getting the bottle steriliser ready and boiling water for his formula milk for the day. If I had time I'd also prepare his reusable nappies after they had been washed and dried. 

At about 7:30am I would go wake up my wife so she could have a shower before I went to work and I would look after the boy in the meantime. We decided that my wife would get as much rest as possible and not the other way around since she would be the one spending all day with him on the go - remember, he didn't like napping. She basically needed as much rest as possible whereas, despite me having to do a full day's work too, at least I would be sitting down for most of it and downing cups of tea through the day.

Once I got home from work I would take over from my wife and give him his bath and get him ready for bed. In the first month that tended to be quite late as he was still getting used to a regular bedtime so that meant I had to learn how to hold him in one arm whilst I ate my dinner with the other. Eventually though I was responsible for putting him to bed by giving him his bedtime bottle, burping him and letting him fall asleep on my shoulder before putting him in his moses basket.

Here's a little secret I'll let you in on: whilst letting him fall asleep on me I spent many a night playing through Angry Birds on my phone. I actually got quite far through the game in this fashion!

"What dear? No, I'm putting our son to bed, what did you think I was doing?"
Image courtesy of Echo Enduring Blog ( http://blog.echoenduring.com/2010/11/23/learning-about-design-from-angry-birds/)

It Does Get Better

My last post may have left you thinking that raising a child is a hellish experience, and initially it is incredibly demanding. It still is but as 6 months roll on you realise that you can deal with things better now, that he also grows up more and changes with you and somehow you both meet in the middle to end up having fun together.

He seems a lot happier now :)

Monday, 16 July 2012

Is It Really That Complicated?

I've recently been reading Fabien Sanglard's blog, particularly his fascinating code reviews on the Doom and Quake source engines. Apart from making me feel a bit stupid not understanding how BSP trees work, something else strikes me regarding my own work:

What I do isn't really that complicated.

At the heart of my job I write code to make a website work, and if I consider the bare essential tasks that it needs to do I think I'd have the following shortlist:
  1. Get data from a database
  2. Do something to the data
  3. Put that data into a webpage and send back to the client
  4. Profit
By now it's safe to assume we've figured out how to do all of these steps easily - except perhaps the last one! There are a ton of ways to read and write to a database from code, either using ADO.NET or a variety of ORM frameworks, just as many ways to visualise that data (WebForms, MVC, Silverlight etc), and the only real work you should do in theory is the logic that sits between those parts.

Yet if this is all I need to do, why does it still seem so complicated to get anything done? Why does it still take me ages to implement a new feature when "code-reuse" should be helping me? I mean, it's not like I'm writing a game engine with crazy 3D maths and physics to calculate in nanoseconds, attempting to cure cancer or even writing software for spacecraft. Apart from some technical challenges that do exist, I think it mainly boils down to two things.

Other People

Your customers usually don't tend to think in the same way as you do. They might say "hey, can you add in the ability to search our website like Google? In fact, can we not just use The Google on our database or something? And possibly email all the search results to us? It can't take that long, right?" I like to try and keep things as simple and generic as possible, yet find that when "other people" get involved it tends to spiral out of control.

Take, for example, the financial sub-system I inherited from my predecessor. At work we have a system which calculates how many units each of our clients uses based on what assessments have been completed and how many reports have been generated. These units are then used by account managers to translate into real money to calculate invoices, such as 1 unit = £10 for instance.

So this sounds simple, right? Surely it's just adding up numbers and computers love adding up numbers. Did I mention though that if component A was generated before component B then you only add units for B, but if C and B are combined into one then we halve the units of A. Oh, I forgot, if D is generated between B and A then we add C and E together but only cap to a maximum of 6 (which can be changed based on which country you are in) and then if you bring F into the mix... and this kind of logic goes on and on in an endless spiral of doom.

Why does the system work this way? Because that is how other people decided it should work, because apparently business rules should never be simple. It also didn't help that this evolved, as most products do, into a big mess which means that business rules end up circling around each other without you even being fully aware of it.

When I first started this job I had to spend 3 months understanding all the many intricacies of this system because only my predecessor knew how it truly worked - despite being told by the managers what they wanted. It has now gotten to the point where only I know how every item is charged for and even the management have to double check with me.

And to be fair, there is one other thing that tends to complicate matters just as much as other people...

Myself

I tend to get very attached to the code I write. In an ideal world I feel as though my source code should be beautiful to gaze upon, to be able to admire it's sheer simplicity whilst also marvelling at how it can handle so many complex tasks at once. Sometimes I look back on code I wrote maybe a month or two ago, which at the time I was perfectly happy with, yet now I feel it is ugly and horrible and what was I thinking? This simply has to go because now I know exactly how it should be written...

But this is the real world and experience has taught me that sometimes I have to just "get it done" no matter how it ends up. And if we're being honest who else apart from me really cares about what my code looks like? The other day I decided to bash-out three quick features for my website as I felt that customers really needed them; I created them as quickly as possible (since I do have other projects to complete) so the code wasn't pretty, sometimes even copied-and-pasted with some changes. I look back on it now and I don't like how it looks. Yet my customers won't care, because what they see are three new features that make their life easier and they work, which at the end of the day is the most important thing in your product.

Keep It Simple, Stupid

Simplicity is what I strive for in life. I genuinely feel that the simplest solution is always the best as there are fewer complications to consider and less chance of anything going wrong, and I really try to impress that upon people. Yet at the end of the day outside factors have a way of creeping in and adding complications to your best laid plans, and I've built up enough work experience to realise that although the simplest solution may be the best, it's not necessarily what people want.

Friday, 6 July 2012

Becoming a Father: One Year On - Part 2

This is the second part of my retrospective on my first year as a new father. To view all the parts, please click on one of the links below:

Part 1 - The Beginning
Part 3 - Getting the hang of things
Part 4 - The Accident

This post focuses on...

The First Two Weeks

The day after my son was born I woke up bleary eyed and called my parents and in-laws - now forever know as "the grandparents" - to tell them the good news; they had been calling all night but I was a little tied up at the time. I had breakfast, a quick shave and headed back to the hospital to pick up my wife and son.

My wife was fortunate enough to get a single room for the night - usually you can get at least 6 new mothers and their babies in a ward room. Even so my wife didn't get that much rest due to my son needing regular feeding and nurses popping in and out constantly to check on mother and child. So I think she was glad to be getting out of there and back home, plus it seemed the hospital kind of wanted the room back; it was never said, just implied since this is the NHS we're talking about, always under strain. On a side note at least she wouldn't have had to eat the lunch I saw them bring in; the NHS is a great institution but they never have got the hang of meals anyone would willingly eat.

So, new baby in his new car seat and me carrying a metric ton of samples of various baby related paraphernalia, I managed to finally get everyone in the car and get them home. And then the realisation dawned on me and my wife: what the hell do we do now? Because you spend a lot of time thinking about how it will be and reading a lot of books to learn how to look after a baby, but nothing says "trial by fire" more than bringing home your first-born and having to figure out everything you need to do to look after them by pure guesswork.

Breastfeeding

Breastfeeding in particular stressed my wife out a lot. You would assume, maybe from seeing people doing it or just the general impression that the idea gives, that it would be an act that both mother and child instinctively know how to do, like they are hard-wired to "just do it". Nothing can be further from the truth. Of course a newborn baby does have a natural suckling instinct, just no way of knowing where to apply it. And it's no easier for the mother - it's very easy to get the baby up to the breast but it's not easy to see whether they are latched on correctly due to the positioning of everything, with no idea how much milk they have drunk, if any. Add to that the pressure of midwives always telling you that "breast is best" and my wife refusing to try any other way, it resulted in a very stressful time.

That first day I don't think my son got much milk down him due to both our inexperience, my wife getting very upset by the end of the day. In the end he did sleep almost through the night - which helped my wife who was still exhausted from childbirth - but we were still worried he wasn't actually getting any milk. Fortunately the midwife who came to visit on the second day explained to us that a) you can express breastmilk and give it to him in a bottle and b) give him formula milk at the same time whilst learning the breastfeeding technique. So we resolved to go out to the supermarket and get some formula milk - our first trip out so it probably did us all good.

Chaos

Babies change everything. Suddenly all your little routines that govern your life are thrown out of the window and you are forced to re-learn everything. So apart from having to know how to change nappies, how to feed them, how to burp them, how to dress them and a thousand other little things that you never thought about before, you also have to try and find order within the chaos that a newborn brings into your life. As a programmer, who relishes procedures, order and routines, I found this very hard.

Take, for example, the night feeds - because your job as a parent doesn't end when the sun goes down, no siree! Every 3 hours my son needed feeding - and I mean every 3 hours, morning and night. Before he was born I insisted to myself that I would do my share of everything - nappy changing, cleaning him, the works - and since my wife was starting to express milk it also meant I could help with feeding him. This also meant getting used to a new sleep routine (or lack of it). As a result, we both basically went to bed at around 8pm for nearly 3 months because we were too exhausted to stay up any later!

There was also the night of the third day when he just would not sleep and cried and cried all night. We tried everything we could think off and were getting to our wits end when we realised that letting him suck our finger helped, but take it away and he would start crying again. It got to around midnight, when I was sitting up in bed with him sucking my finger and not being able to get to sleep like this, when I declared to my wife "I'm going to buy some dummies. Now".

Another thing you learn as new parents is to let go of all your pre-conceptions. My wife had many ideas that she thought would be good for our son such as breastfeeding, no dummies ("too unsightful") leading all the way up to baby-led weaning. We reluctantly learned the hard way that a baby doesn't care one bit what you think is best for them, it will do exactly what it likes and there is nothing you can do about it but adapt to them. So I had to drive to the midnight supermarket to get some emergency dummies, which let him at least suck on something while he slept in his crib and gave me my fingers back.

I Don't Like You

Perhaps the thing I personally and emotionally found hardest to accept in my two weeks off work was the fact that my own son seemed to hate me. Well, perhaps "hate" is too strong a word but he definitely did not like me. No matter how I held him or cuddled him he would just cry and cry at me, only stopping once his mother took hold of him; he was inside my wife for nine months, knew her like the back of his hand, whilst he only met me a few days ago and did not like what he saw.

This is a very hard thing to take, the fact that your own child does not seem to like you. I had an idea that it would be tough but I also imagined that he would at least just lie in my arms looking all cute and all, but there was none of that. I even looked after him for a whole afternoon on my own while my wife went to get a haircut; I insisted to her that some time alone for her would do her some good. It also meant that I had an entire afternoon of him crying at me, pretty much non-stop. Add on top of that the sleepless nights, trying to keep the house in order (though I soon gave up on that notion) and keeping up a repetitive 3-hour cycle of the same tasks - feed, burp, change nappy, prepare the next feed - I have to admit it almost broke me.

But It Gets Better

So far I'm making fatherhood sound like hell on earth, but overall it isn't. What people reading this who don't have children of their own must understand is that the shock of changing your life from free-and-easy to instant parent is incredibly severe. Everyone says that raising children is tough but my words alone cannot convey just how tough it is, the only true way of understanding is to experience it for yourself.

And yes the first two weeks of my son's life were incredibly tough, for me and my wife, I cannot lie about that. But every parent would also tell you that things get easier. At the time, when you haven't slept all night and every minute drags on forever, you can't see the end but it is there. And things did (very slowly) start to get better; towards the end of my paternity leave my son was starting to get a bit more used to me, partly by me realising that he wanted to be moving at all times - that meant rocking him in my arms non-stop, which wore me out physically but at least he wasn't crying! And once you start to see a pattern in his routine - such as when he appears to sleep, when he last had his feed so you can gauge when the next one should be - then you can get into the swing of things.

Tuesday, 26 June 2012

Using Pocket and its Bookmarklet on Windows Phone 7

I have a Windows Phone 7 smartphone, a HTC Trophy to be exact. I can't speak for iPhones or Android phones - since I've never used them - but I like my WP7 phone (just not in a religious way). It presents everything in a nicely laid out fashion, I really like the Live Tiles and how they give me information without having to go into apps to find out, and best of all for me it seems really simple; it just does enough for what I need it to do.

But this isn't a post about how I love Windows Phone 7, this is a post about a common scenario I face day to day.

Reading It Later

When on the go I'll read through my Facebook and Twitter feeds using WP7's built in social network integration - it's not fancy but boy is it faster than any dedicated Facebook/Twitter app you'd care to try. OK, enough of the hard sell, time to focus...

Often I'll come across a link that someone has posted pointing to a blog post/news article/video/whatever that I'll be interested in, which of course will pop open in IE Mobile. Sometimes I'll read it, but other times I just want to "read it later" - either the article is too small for a phone screen to read easily, I don't have time to read it all, or it's a video and I would rather not eat up my data contract.

So my current system of saving these one-off things to look at is to email the link to myself - very easy to do in IE Mobile using the "Share" menu option - but then I'll end up with loads of emails in my inbox which are just reminders for me to do something. I just feels like there must be a better way...

Enter Pocket

I asked friends and looked around and eventually settled on Pocket (formally Read It Later). All it does is collect links that you save via a number of methods which you can then look at later. I went with this one because although it doesn't have much in the way of direct WP7 integration there are at least two simple ways that I can save links to my Pocket account from my phone:
  1. Email the link to Pocket. Again quite simple thanks to the "Share" menu.
  2. Add a bookmarklet to your favourites to magically save links.
But if you look at the instructions they give, it tells you to drag and drop the bookmarklet to your bookmarks bar because they are assuming you are doing this from your PC, which is not something you can do on a touchscreen.

Adding Bookmarklets to your Phone

Fortunately you can add bookmarklets to your phone's browser, it's just not as intuitive. Here's how I did it for the Pocket bookmarklet but I assume the same process can be applied for other sites:
  1. From your phone's browser, go to the Pocket bookmarklet page to see the button that has the bookmarklet link.
  2. Press and hold the bookmarklet button to get the "right click" menu to appear, then tap "Copy Link".
  3. Tap the "..." on the browser's menu bar to see the main menu and tap "add to favourites".
  4. Clear everything in the Web Address field and paste in the bookmarklet link - a long string of JavaScript code.
  5. Enter a memorable name for it - I've called mine "+ Pocket" like the website suggests - and save it.
That's it, you've now got a working bookmarklet in your phone's favourite list. Now any time you see something on your phone's browser that you want to read later, just go to the favourites menu and tap the bookmarklet to save it to your Pocket account.

Friday, 15 June 2012

Refactoring with WinMerge

A short post which I thought I would share since I found it useful.

The other day I was looking at some code and I knew that two functions were written in a very similar way, so I wanted to refactor them into just one function. But how do you see how similar they are? You could do it by eye, but there could be human error. Surely a better way is to have the two functions side by side so you can see the differences. And what do you know, there are tools out there that are designed to do just that.

So here is what I did:

  1. Copy the two functions into two separate temporary files.
  2. Compare those two files with WinMerge (or your favourite diff tool).
  3. Immediately see what's similar and what is different. Here's what I saw:

I can now see that a lot of it is very similar, giving me some indication of how I could refactor them into one function.

Sometimes the simplest solutions are the best. 

Wednesday, 13 June 2012

Becoming a Father: One Year On - Part 1

I'd thought I'd choose a different topic to what I usually write about. My son is now a year old, 13 months to be exact - sometimes it is hard to believe it - so I thought I would give a retrospective on my transition into fatherhood.

To read all the other parts to this series, click on the links below:

Part 2 - The First Two Weeks
Part 3 - Getting the hang of things
Part 4 - The Accident

The tl;dr version: being a parent is hard! No, I mean really, really hard!

The Beginning

Last May 2011 my wife announced to me at an unfavourable hour that her waters had broken. After calling the midwife we were told to make our way to the hospital in order for my wife to be induced; apparently her waters were greeny-brown, an indication that our son may have passed his very first stool before being born. Because midwives get concerned that this may cause stress to the baby, they wanted to induce my wife to get things going.

For about 8 hours my wife was pretty much left alone hooked up to a monitor to check the baby's vital signs, with very little sleep for both of us (a sign of things to come. More on that later...) Only till the next shift did a couple of midwives come and attend to us, and attend to us they did: my wife then had round the clock care which was really good for her as she was getting upset at the lack of information given to us.

Perhaps you've seen how babies are born on medical shows? It takes a lot longer than that. From about 8am till 1pm my wife was fed some sort of hormone drip which was meant to kickstart labour. The midwives were very good to my wife, always chatting and taking her mind off things. Once I came back from lunch did I really start to see the affects, as my wife's contractions had started.

This was the bit where I came into the picture. Everyone knows from TV and films that the father is meant to stand next to his partner and encourage this very slow breathing technique through your mouth whilst your partner is screaming in agony telling you what you can do with that idea. My wife did not shout at me directly but was clearly feeling the pain.

We had planned lots of things during the birth, built into a sort of "birthplan". Here's what new parents learn very quickly: plans of any kind go right out the window. My wife had intended to be in a birthing pool to help with pain relief, but to be induced means constantly being hooked up to drips and monitors. Walking and different positions also became difficult since her mobility was restricted from all these machines. Gas and air helped but there came a point - which originally she said she would refuse - to get the big gun out: the epidural.

After waiting for an anesthetist (resulting in more screaming from my wife) one finally came. She was obliged to give my wife the legal stuff, such as side effects, consent etc, though my wife was sucking on the gas and air constantly and shouting "Yes! Anything!" at that point. It did help with the pain though, the only drawback being she couldn't even stand up anymore: the epidural is injected towards the base of the spine so it basically knocks out anything from the waist down.

We had a bit of a breather for an hour or two at that point, which gave the midwives a chance to discuss with the next shift what has been happening (this would be about 17 hours since we arrived at the hospital). Finally, the big moment had come: it was time to get this baby out.

The next bit has been censored. If my wife saw that I described the birth of our child in any detail whatsoever she would kill me!

...4 and a half hours later, our son entered the world! Now usually this is greeted by the baby taking their first gasp of air and crying, at least that is what I considered to be the norm. Not so my boy; he decided to basically keep quiet, thereby raising alarms and calling in what looked like every midwife, nurse and doctor on the maternity ward to see to him and get him breathing. Let's just say it was the most frightening experience of my life. But there was nothing to worry about in the end, he was breathing just fine and simply didn't want to make a fuss. Cheeky monkey.

He was cleaned up and handed to my wife, who was still completely off her head from all the gas and air she was basically breathing in like oxygen. But it was there, that special moment when you realise that you have a little person that you instantly love. I stayed for another hour or two and then drove home to try and get some sleep while my wife still had work to do giving him his first feed.

All in all it took almost 24 hours from start to finish. I was immensely proud of my wife, who worried she would never be able to do it, and amazed that there was now a new little person in our lives (not very little though; he weighed in at 8lb 11oz, so was hefty enough). As I collapsed into bed when I got home I vaguely wondered what the future would bring...

My boy, less than a day old, wondering where the hell he is
Next time: the first two weeks...

Wednesday, 16 May 2012

How WinDbg Helped Me Find My Stackoverflow

I was faced with the problem recently of trying to work out why the worker process in IIS that was running my website kept crashing. The event logs told me that it was due to a StackOverflow error, but I found this odd. Firstly the fact that something in our code had changed so much that it introduced this error in the first place, and secondly that our default error handler did not catch it.

Basically we use the HttpApplication.Error event to email all uncaught exceptions to us with full details - including the stack trace - but this did not happen with this error. At the very least I would have thought we would get the .Net StackOverflowException emailed to us, but even if it did that does not seem to produce a stack trace. The first instance that we heard about this was that our users were getting kicked out of the web application at random times, and the event logs kept saying this error:
Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to stack overflow.
It turns out that this is one of several critical errors that the operating system simply cannot recover from and the process terminates immediately. But how can we trace where this is happening?

If the .Net framework is not able to help us, then we need to go deeper into the operating system itself. It is possible to get a full (unmanaged) memory dump of the process at the time the error happens, but can this help us delve into managed code?

Enter WinDbg

WinDbg is a powerful tool though with a steep learning curve. It is effectively a debugger that you can use after the event has happened by means of reading memory dump files. These dump files can contain a wealth of information, from stack traces to all the threads running at the time. As a result it can be a bit overwhelming when first introduced to it - I heavily used Google searching for answers to get me through my first debug session with it. But in the end it provided me with exactly what I needed.

I've got my error, I need to know where it is happening, so lets talk about what I did next.

Download Debugging Tools for Windows

WinDbg is one of many applications that is part of the Debugging Tools for Windows kit. Microsoft provides a small installer to which will download further components depending on what you wish to install. There are a lot of things the full toolkit provides, such as driver development tools, but it is perfectly fine to just download and install the debugging tools as standalone components.

You can also install this on a number of Windows operating systems including server operating systems - I will explain why this is useful later on.

Get a Dump File

Once you've installed the debugging tools you'll need to attach a debugger to something. This can be done with the ADPlus, a tool which can troubleshoot applications that hang or crash.

In my case I needed to attach it to the IIS worker process for my website and give me dumps when this process crashed, so I opened up a command prompt, changed directory to the debugger tools folder (in my case this was C:\Program Files\Windows Kits\8.0\Debuggers\x86) and entered this command:

adplus -crash -pn w3wp.exe -o D:\Dumps


The last argument states that all dump files will be saved to the directory given.

Wait...

I then had to wait for my web application to crash, which is ironic since it is not often that a developer wills their code to fail. Since I didn't know when it was going to happen I was prepared for a long wait...

Bang!

Aha! The IIS process crashed again and now I have something to show for it:


Now it is time to analyse them.

Analysing Crash Dumps

Fire up WinDbg and select File > Open Crash Dump, then load the dump file ADPlus produced.

Note: I did this on the same server that the crash occurred on. I originally tried to copy the dump file to my development machine to analyse it there, but WinDbg found that the .Net framework versions on my development machine and the server were slightly different (possibly due to Windows Update) meaning it could not load the CLR data recorded in the dump. Opening it on the same server meant that all framework components were accounted for.

You'll see something like this:


OK, this isn't exactly Visual Studio with pretty colours and icons. Everything you have to do is text based. But we can get through this...

Note: I'm not sure if this was important in my scenario, but I also set the Symbol Search Path in WinDbg to download debugging symbols from Microsoft's servers. This could be used to translate core DLL function calls (such as from nt.dll). The setting I used was srv*c:\symbols*http://msdl.microsoft.com/downloads/symbols which you can add by clicking File > Symbol File Path.

SOS - Save Our Souls?

Step 1 is to load the SOS module. This is a debugging extension module which can delve into the memory dump file (which holds mostly unmanaged code references and symbols) to extract information given by the CLR. This is how .Net developers can use WinDbg and fortunately this module is shipped with every version of the .Net framework in the standard installation folder.

So our first WinDbg command will be to load this extension by typing:

.loadby sos clr

Note: this is the command to load the SOS extension for .Net 4 onwards. For previous versions of the framework you need to run .loadby sos mscorwks instead.


Find the Stack Trace

Now we can finally read the managed stack, so enter the command !clrstack. Viola! A full managed stack trace.

In the case of my dump file I could finally see exactly why a StackOverflow was occurring - far too many iterations of the same set of functions. Thankfully this was easy enough to fix and we've never encountered the problem again.

Conclusion

Sometimes it is best to dig a little deeper into a system (in this case Windows) and this is one of those cases. I could have trawled through all the code changes made since our last update and tried to figure this out for myself. But delving a little into the unmanaged world of processes and core memory dumps really helped. Not that it's not without it's challenges - what I've described above is just the tip of the iceberg with what you can do with WinDbg - but  it does make you appreciate how far you can go to solve a problem.