Resolving “HttpContextWrapper is not serializable” errors after upgrading Glimpse.

If you are doing any ASP.NET development and not using Glimpse you are seriously missing out. It helps is so many ways to troubleshoot and improve performance that I cannot believe how I’ve done any web development without in the past. I’m really grateful for the work that it has been done by the developers. However, today I decided to update all the NuGet packages I thought they were safe and as you would have guessed it, the update broke my MVC4 website. A simple MVC website will probably not come across this issue, but I have …[read more]


Fixing TextChanged event firing twice in Windows Phone 7 (WP7)

I’m currently playing around with WP7 and WP8 development trying to get to grips with the framework. I don’t have a specific application in mind but I’m trying to create a basic application that allows me take notes on the fly. Nothing fancy there. One of the “requirements” is to be able to search across all my notes for a specific word and get all the results back in one continuous list that will contain the name/title of the note that matches the search criteria. In my effort to be fancy, I decided against using a …[read more]


Dealing with “Cannot drop database because it is currently in use” error in ADO.NET

Posted in ADO.NET

I’m a big fun of Entity Framework but every once a while I come across a case where EF is not adequate or the right tool for the job. In one such case, I had to implement some code to perform bulk inserts in order to improve performance. Shortly after I implemented the helper methods my unit tests started failing when attempting inside the tear down method which was responsible for clearing out the test data and deleting the test databases. The error? "Cannot drop database "7139e838-0de2-41b7-8b99-c0eb6a5b02c8" because it is currently in use." Below is …[read more]


Fixing error: "Cannot generate SSPI context" after changing SQL service account

Everyone knows that it is good practice to use a domain or service account to run the SQL service. I’m sure you do too! However, once you do the right thing and change the SQL Service account, you may start getting the following error message when attempting to connect to the sql server: “The target principal name is incorrect.  Cannot generate SSPI context.” The explanation, as given by Microsoft in this KB article If you run the SQL Server service under the LocalSystem account, the SPN is automatically registered and Kerberos authentication interacts successfully with the computer that is …[read more]


Azure - Error deleting VHD: There is currently a lease on the blob and no lease ID was specified in the request.

Working with Azure the last couple of days, I came across an issue where I deleted a VM but I was unable to delete the associated vhd blob. The error received was similar to this: There is currently a lease on the blob and no lease ID was specified in the request While this error is expected if a VHD is still registered as a disk or image in the portal, the problem arises where a lease remains even if the blob is not registered as a disk or image in the azure portal. If you receive one of these …[read more]


Using NCrunch to enhance your tests in Visual Studio

I have recently come across nCrunch during a code demo. nCrunch is an automated, concurrent testing tool for Visual Studio and I have to say that I am pretty impressed with this ‘little’ piece of software. nCrunch is an 3rd party tool that allows you to continuously run tests as you write them. Actually, the tests are run every time you change any part of your code that is being monitored by nCrunch and may have an impact on your tests. The tool is responsible for building and running tests as it sees fit. Installation was easy and painless. As …[read more]


Configuring Visual Studio 2012 to work with the Xamarin framework and PCLs

If you want to do cross development using Xamarin and Visual studio, you need to install the Xamarin tools for Visual Studio. This will allow you to create solutions that target one or multiple platforms using the magic of MVVM (Model - View - ViewModel) and PCLs (Portable Class Libraries). The Visual Studio installer can be acquired here. The download is over 1.2Gb so it may take some time depending on your connection. The installation is fairly quick and painless with only a few steps to follow on the wizard. Once the installation is complete, you can start working …[read more]


An Object with the same key already exists in the ObjectStateManager, Entity Frawework

I have a generic repository which I use in my application to manage a large number of objects. I wrote the necessary unit tests to ensure that all methods work as expected and in isolation all was good. However, as soon as the application started implementing more complex operations, I came across the following error during updates: An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key.” In my controller I do something along these lines: Nothing unusual here. Move on, nothing to see. I fetch the existing user …[read more]