I was reading a copy of Jeffry Richter’s book CLR via C#today, and came across this note on p.538 “The .NET Framework offers a feature called Managed Debugging Assistants (MDAs). When an MDA is enabled, the .NET framework looks for certain common programmer errors and fires a corresponding MDA.”
What? I have I been living under a rock? Why hadn’t I heard of these before?
Well it turns out these have been around since .NET 2.0 (Visual Studio 2005), and you’ll find the list of available MDAs in the Exceptions dialog (Debug Exceptions) or in 2015 in the (new and improved non-modal) Exception Settings window (Debug Exception Settings).
I must confess virtually the only time I visit this dialog/window is to expand Common Language Runtime Exceptions when I want to modify which exceptions the debugger automatically should Break When Thrown, so may be that’s why I’ve overlooked them.
The MDAs enabled by default in Visual Studio are:
You can also see the complete list and find out more about MDAs at Diagnosing Errors with Managed Debugging Assistants. MDAs are actually built in to the CLR and and as such aren’t user-extensible. Stephen Toub described them as “Asserts in the CLR and the base class libraries that can be turned on or off”.
So while I don’t think I was consciously aware of them, it’s possible I have see the odd MDA exception dialog – but probably just didn’t noticed the difference from the usual exception dialog. Here’s an example of the BindingFailure MDA:
Bringing things full circle, it turns out that there’s a StreamWriterBufferedDataLost MDA which is what Jeffrey went on to highlight as a way to identify the problem where you’ve got a StreamWriter that didn’t get a chance to flush data to the stream before it was finalized (say because the underlying stream itself was already disposed).
This MDA is not enabled by default, so it might be something worth doing if your code makes use of StreamWriters. Note: this is a debugging feature – it only works when you’re debugging an application. There may be other MDAs that you might benefit from enabling, depending on the kind of things your code is doing.
In some ways, MDAs are a bit like a debugger-time version of FxCop (or FxCop’s probable replacement - the new Roslyn .NET Analyzers and Code Aware Libraries).
Back in April, I sat the Microsoft exam 70-494 Recertification for MCSD: Web Applications.
And failed 😢
And not by that much – 663 (the pass mark for Microsoft certification exams is always 700). So it’s hard to say, but it was probably around 2 – 4 incorrect questions.
But fortunately Microsoft were running the “SecondShot” promotion until the end of May, so if you failed an exam you could try it again later for no extra cost.
So today I re-sat the exam, and this time I passed (764 this time). Yay 😀
I think this might be the first time I’ve done a recertification/update type exam. Because they are essentially combining what would otherwise be two separate exams (70-486 and 70-487) it does make it a bit more challenging as the breadth of subjects covered is essentially also doubled. Take a look at the Skills Measured section – there’s a fair bit there!
You don’t get told which specific questions you got wrong, but I was able to recall a number of topics that came up in the first exam that I was unsure about so I took a bit of time to review those areas and become more familiar with them for the second time around. These were largely areas in which I don’t normally cover either for work or leisure. Of course there’s no guarantee that you’ll get the same questions – but it would be silly not to be prepared if something similar came up again.
So now that’s done – it should keep the Microsoft Certified Solutions Developer: Web Applications certification active for another two years. It will be interesting to see what kind of skills they’ll be testing next time around.
My second talk for the ANZ Coders virtual conference is now online. “10 unusual tips & tricks for .NET” manages to demonstrate 10 different tips in under 30 minutes.
Source code for the demos is on Github. Over time, I hope to add to this repo as I come across new tips. If you prefer to see something in-person (and with pizza), then come along to the next Adelaide .NET User Group meeting on June 10th, when I’ll be doing an “extended play” version of this talk (and probably by then with a couple of extra tips thrown in to boot!). Register on MeetUp.