Programming

WPF BackgroundWorker and the Mysterious 0x80131623 Error

Posted on

If you use Windows Presentation Foundation (WPF), you are very likely to come across the awesome BackgroundWorker and its best friend the Dispatcher. The BackgroundWorker lets you chuck a long-running process onto another thread, allowing the UI to remain responsive. When the BackgroundWorker needs to pop something on the UI, you ask the Dispatcher to […]

Programming

Improving Your Code with NDepend and CQL

Posted on

I have been talking a fair bit recently about code quality tools such as Resharper and NDepend. In this article, I will explain how to use one of the features of NDepend to improve your code quality. On of my favourite features of NDepend is the suite of “code query language” tests, which run against […]

Programming

NDepend Contextual Help

Posted on

I’ve talked a couple of times about NDepend recently, in the article NDepend For Beginners. NDpend is jammed full of code analysis tools, but sometimes you need a bit of a hint to tell you what is going on in the various matrix displays and graphs – well now NDepend is getting some improvements to […]

Programming

NDepend for Beginners

Posted on

NDepend is a code-quality tool that integrates with Visual Studio (2008 and 2010… and probably older versions too if you happen work in a museum). Within about 10 minutes of installing NDepend, I had already created a really handy component diagram that pointed out that one of my name-spaces was wrong. I haven’t even properly […]

Programming

Mocking NHJump In Your Unit Tests

Posted on

NHJump is an excellent way to jump start your NHibernate implementation, giving you instant repositories and query definitions from the word go. Here is a quick bit of information on how you can go about stubbing and mocking the NHJump repository for the purposes of Unit Testing. Please note… this is an initial draft and […]

Programming

JavaScript Includes and Rewritten URLs

Posted on

I recently answered a question on a forum about JavaScript includes in ASP.NET MVC and as the question came up again today, I thought I’d share the answer with the world. The issue that people are coming up against is that they have a script include with a relative path to their script file. Because […]

Programming

Always Use Those Curly Braces

Posted on

I write a lot of code in a lot of different languages – but there is one common rule I apply to all of them… when you use an “if” block, always put in the curly braces even if you don’t need them. Many errors are related to violations of this simple style rule. I […]

Programming

Get NMock2 to Return Out Params

Posted on

There are plenty of mocking frameworks out there, with Rhino Mocks and Moq leading the way. Personal preferences aside, I am currently working on a project that is using NMock2 for mocking and found that the following feature isn’t very well known. In the process of adding unit tests to some legacy code, before I […]

Programming

TransactionScope and WCF Services

Posted on

The problem I encountered was that, while I had started a TransactionScope in my calling method (and could even see a current transaction in my services) – an error in a second WCF service call was NOT rolling back the changes made in a previous WCF service call. The behaviour was as if each service […]