Saturday, November 7, 2009

Fixing "Unexpected error occurred. Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

( If you don’t do hard-core Analysis Services, Reporting Services, or Integration Services development work with Microsoft Business Intelligence Development Studio, you can safely ignore this blog. )

On my workstation there was an incompatibility between Visual Studio and the SQL Server Binaries. Which led to this error:










Symptom:
Certain operations from Business Intelligence Development Studio work as normal, and other return a message: “Unexpected error occurred. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.” (See attached)

This error can occur if there are incompatibilities, between the versions of msmdlocal.dll and msmgdsrv.dll in these two locations:
C:\Program Files\common files\system\ole db
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies

Issue: Make sure the build number of your local binaries matches the build number of the server you are working with. In this case the target server is at 9.0.4035.0, however on my system we were actually running at 2 other build numbers:
In C:\Program Files\common files\system\ole db msmdlocal.dll and msmgdsrv.dll was 9.0.3042.0, but in C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies, msmdlocal.dll and msmgdsrv.dll were at 9.0.1399.0

Solution
My solution was to apply both SQL Server SP3 and Visual Studio SP1 (or whichever versions match your target environment).

References:


Followers