“Attempt to read or write protected memory” error from SSMS for System.Data

I just spent a couple of hours fruitlessly trying to solve a problem and thought I’d blog the solution in case anyone else hits the issue.

A few months back I got a new laptop and installed SQL Server 2014 on it and everything worked fine. A few weeks ago I installed SQL Server 2008 R2, SQL Server 2012, and Visual Studio 2013. After that, any time I tried to use the Dedicated Admin Connection (DAC) through SSMS, I got this error:


I did some research online and couldn’t find any solutions that worked. So I tried repairing the installation, installing 2014 SP1 CU2 (latest build at time of writing), and a bunch of other things – to no avail. I was just about to give up and post a request for help when I thought I’d do one more search online.

When I did that, I noticed that all the solutions I’d tried had revolved around the assembly name in the error being something to do with SQL Server. In my case, it was System.Data, which is a .NET assembly. I added that into my search and found a bunch of new hits. Lo and behold, buried in the comments on a Stack Overflow question, I found the solution.

Turns out the problem was because of an upgraded .NET version, and the solution was to run the following from a command line and then reboot:

netsh winsock reset

And after that SSMS worked perfectly.

Hope this post helps others find the answer quickly in future!

My upcoming sessions at PASS and SQLintersection

The two major Fall conferences (PASS Summit and SQLintersection) are coming up in October so I wanted to give you a heads-up about what I’ll be presenting.

The workshop I’ll be doing at both conferences is based on one of my favorite topics – wait statistics and using them for performance troubleshooting. I’m very passionate about helping people learn about wait statistics and how to use them *correctly* as an invaluable aid when troubleshooting performance problems in SQL Server. You may have seen one of my user group sessions over the year where I’ve talked about wait stats for 60-90 minutes, but here I’ll have an entire day to expand into techniques for further troubleshooting, rather than just evaluating the wait and latch statistics themselves.

The no-frills title of the workshop is: Performance Troubleshooting Using Waits and Latches

Here’s the abstract:

One of the first things you should check when investigating performance issues are wait and latch statistics, as these can often point you in the right direction for further analysis. Unfortunately many people misinterpret what SQL Server is telling them and jump to conclusions about how to solve the problem – what is often called ‘knee-jerk performance tuning’. In this full-day workshop, you’ll learn how to investigate and interpret wait and latch statistics – practical techniques you can take home and start using immediately. You’ll also learn what a myriad of wait and latch types actually mean and how you can investigate lightly-documented types to gain insight into what causes them. Don’t waste time when it comes to performance troubleshooting; wait statistics are the fastest route to understanding your problems and this workshop will help you get there faster.

If you come along I promise you that you’ll learn a ton of really, really useful information and techniques – I’m looking forward to teaching it tremendously.

You can get more details about this year’s PASS Summit in Seattle, October 27-30 at this website.

You can get more details about this year’s Fall SQLintersection in Las Vegas, October 26-29 at this website.

Yes, unfortunately both conferences are unavoidably on the same week, which means some creative flying around the country on our part.

Whichever conference you go to, I’m looking forward to meeting you and I hope to see you in my workshop!