Dot Net What Not Posts

And I’ve seen a few! I was just trying to back up an SQL database, and got this truly wonderful error message… Not much you can say to that is there?

A quirk I have noticed with Visual Studio (2013 and later) is that sometimes when you break in your code and hover your mouse over a variable, instead of showing you the little pop-up that allows you to examine the variable, you don’t get anything. If you try using the Immediate window to see what the variable holds, you get a really informative message like “Internal error in the expression evaluator” which doesn’t help a lot. This might be a bug in the managed debug engine that ships with Visual Studio. Try turning on Managed Compatibility Mode (which effectively turns it into pre-2013 debug engine), located under Options – Debugging: This fixed it for me. Source: http://stackoverflow.com/questions/21854426/get-internal-error-in-the-expression-evaluator-on-add-watch-function-when-tr

Stopping a build If you are working on a Grown-Up Solution, that has lots of projects, and takes days to build (OK, slight exaggeration, but you know the feeling!), you might sometimes want to cancel a build. This usually happens when you’ve just changed something, started a build and then realised you needed to do something else before trying to build. It’s very frustrating sitting there waiting for VS to finish the build, only to tell you in a smarmy voice that the build failed. “Yes, I know the build failed, that’s why I wanted to stop it you condescending computer!” It’s at this point that you feel like smacking it in the face (or monitor), but you don’t, because you are too polite. What you would really like to do is stop the build. Thankfully there are a few ways to do this, presented here in reverse order of…

In case anyone has been hiding under a rock for the last few months (and I can’t say I blame you if you have), Microsoft’s latest stupidity is to ignore decades of usability studies, and have everything on the UI look like it’s shouting at you. In particular, Visual Studio 2012 and later have menu bars that look like this by default… Does the word “Bleah!” spring to mind? Thankfully, this monstrosity is easy to fix, but requires using the registry editor. If you aren’t comfortable mucking around in the registry, then ask an adult to do it for you 🙂 Click the Windows button on your keyboard, and type regedit in the search box. Click the Enter/Return key, or click the RegEdit icon that apepars in the search results. Navigate to the registry keys shown below: For VS2012: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General\ For VS2013: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\General\ Future versions of Visual Studio will probably follow the same…

Bored of the usual methods of inflicting torture upon myself, I thought I would upgrade SQL Server 2008 R2 to SQL Server 2014 (stop laughing at the back!), because, erm, well it seemed like a good idea at the time.

Read more to hear the whole sorry story

One of the great things about WPF is that you can declare all your binding in XAML, and not have to write any code. One of the most painful things about WPF is that you can declare all your binding in XAML, and not have to write any code. Huh? OK, so I am tired, but I’m not that tired, there was some sense in those first two paragraphs! XAML binding is extremely powerful, and allows you to do fab things without having to write a lot of C# (or VB.NET if you’re weird). However, when things don’t work as you expected, it’s very difficult to debug XAML. With C#, you can step through the code line by line, and see where it went wrong. You can’t do that with XAML. However, you can get some clue as to what went wrong using System.Diagnostics.PresentationTraceSources. Never heard of it eh? Don’t feel bad, nor had I…

When laying out controls on a window or user control, it is common to end up with wads of XAML that looks like this: Before you even start adding in the controls, you have quite a lot of XAML just for laying out the grid itself. Enter stage left, the GridHelper class (round of applause please). With the addition of the appropriate line to the namespace section of your window or control (depending where you save the GridHelper class): …you can reduce the XAML spaghetti above to the rather more succint: The row or column definitions are now reduced to a comma-delimited list of heights or widths. These can be absolute or star values, and can take an optional minimum value (specified after the colon). Grid splitters Grid splitters are a common feature in complex layouts, and the GridHelper class allows you to add them without writing extra XAML. All…