SQL Server Management Studio crashes after opening or creating database diagram - sql-server

I have an error message that occurs every time I use SQL Server 2012 Management Studio to open or create a new database diagram, followed by an automatic restart of SSMS.
The error message is
Attempted to read or write protected memory. This is often an
indication that other memory is corrupt.
(Microsoft.VisualStudio.OLE.Interop)
Here's what I did to produce this problem:
Earlier, I had installed SQL Server 2008: via an option available when I downloaded Visual Basic Express 2010. No errors yet. I could create and edit database diagrams without problems. Then I uninstalled VB Express 2010, and installed Visual Studio 2012, only to find out that it was a trial version, which I didn't like, so I uninstalled Visual Studio 2012. I launched SSMS 2008 and tried to open a database diagram in one of my databases. I received an error that said
Specified Module cannot be Found. (MS Visual Database Tools)
I installed SQL Server 2012 with Management Studio, and then used the SSMS 2012 to try opening the database diagram. And instead of Specified module error, I got the error about attempting to read or write protected memory.
I am running Windows 7, SQL Server 2012 Express and I didn't uninstall SQL Sever 2008 Express (yet), Visual C# 2010 Express, Visual Basic 2010 Express.
EDIT: I attempted to fix this problem by applying a hotfix named SQLServer2012_RTM_CU1_kb2679368_11_0_2316_x64. It did not fix the problem. The hotfix was suggested by a user in an MSDN forum at this link: http://social.msdn.microsoft.com/Forums/en/sqlexpress/thread/1753d7ba-f6ec-4a8e-a1c9-ded2a5b7c607

I bumped into the same issue. Mine is SQL 2012 in windows7. I was trying connect to a sql server 2014 in Windows 2012 R2.
The problem was resolved after I upgraded my SQL 2012 client to 2014.
It is interesting that it was fine to work with SQL2014 with Windows 2012 but not windows 2012 R2.

For the sake of completeness I added this answer with all steps
required to solve this issue
It is a stupid error, which can occur in nearly all sersion of SQL Server Management Studio.
Look for a machine that had SSMS installed which ist still working without any error.
Copy all files of the folder from the working machine to the faulting machine
Folder 1: C:\Program Files (x86)\Common Files\microsoft shared\Visual Database Tools\
Folder 2: C:\Program Files (x86)\Common Files\microsoft shared\MSDesigners8\
Start SSMS again and the error is gone
verified for 2008R2, 2012, 2014

I was used to get this message and to get the management closed ALL-THE-TIME
when I notice a pattern in the bug ( and given the message I guessed the bug was isolated when trying to deal with the diagram database objects in the memory), if I create the diagram, place a table, put the first column with pk, save, close and open the diagram again it started working...
I used to repeat this for every new table added in the diagram without saving in disk
somehow, it stopped happening maybe after some updates in the host
I hope it works for you too

I figured out the answer, thanks to another post located here. Basically, even though my visual studio 2012 install was the trial version, it seemed to cause the same problem as the visual studio described in the link. Check it for a workaround.

Related

SQL server management studio : Cannot find one or more component please reinstall the application

I had visual studio 2010 on my VM and I Uninstalled it by visual studio 2010 uninstall utility which I downloaded from here :
https://aka.ms/vs2010uninstall
it also uninstalled visual studio 2010 shell...
Then I Installed Visual Studio 2015 Update 3. After that, I can't open sql server management studio 2012. It gives me this error :
Cannot find one or more component please reinstall the application.
also when I try to repair it, it gives me this error:
TITLE: SQL Server Setup failure.
SQL Server Setup has encountered the following error:
The required MSI package 'c:\6b55b72929daeb5953cfca72\1033_ENU_LP\redist\VisualStudioShell\VSIntSetup\vs_setup.msi' doesn't exist.
Error code 0x858C0038.
For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft%20SQL%20Server&EvtSrc=setup.rll&EvtID=50000&EvtType=0xFDC38F1F%25400xE62C46B1%25401420%254056
what should I do?!
SQL server management is sharing a lot of components with visual studio, in order to use it on the same machine the painless and best option is to keep them aligned as much as possible.
Except in case you are going to connect to a newer (Azure) version of SQL-SERVER you can easily solve the situation by uninstalling the current version of SQL Server Management and installing MS-SQL Server Management 2016.
Likely also installing even a newer version will not gave issues, but using an older one will be a source of troubles and also a no-sense since the Management Studio is backward compatible with older SQL Server versions.
Start regedit.exe
Go to HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio
Delete 11.0_Config
Restart ssms.exe

Microsoft SQL Server Management Studio Opening Error

I installed SQL Server Management Studio and it worked fine. After that I updated my Visual Studio from 2010 to 2013 Express edition, now it is not working with this error message :
Cannot find one or more components. Please re install the application
I re-installed it but still same issue. Any suggestion?
The SQL Server 2014 Management Studio answer
SSMS 2014 relies upon the Microsoft Visual Studio 2010 Shell (Isolated) Redistributable Package. If this is uninstalled, SSMS will produce the error message 'Cannot find one or more components. Please re install the application'. This can be corrected by:
Reinstalling the VS 2010 Shell from here: https://visualstudio.microsoft.com/vs/older-downloads/isolated-shell/
Try opening SSMS again. If it still gives the error, then:
Run Repair in SQL Server (2014) Setup
The SQL Server 2016 Management Studio answer
SSMS 2016 relies upon the Microsoft Visual Studio 2015 Shell (Isolated) Redistributable Package. If this is uninstalled, SSMS will produce the error message 'Cannot find one or more components. Please re install the application'. This can be corrected by reinstalling VS 2015 or by installing the Microsoft Visual Studio 2015 Shell (Isolated) Redistributable Package.
I just solved the issue :
SSMS depends on VS 2010 and by uninstalling it this error occurred.
There is a folder named 1033_enu in my server installation pakage
Inside that i found a folder VSS i.e Visual studio shell
and inside that VVS setup.
i just run this setup and it solved the problem for me. Thank you
For SSMS 2016 (at least v16.5.3) delete the following folder from the registry and restart the app:
HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio\13.0_Config
The SQL Server 2017 Management Studio answer
SSMS 17.1 also depends on Visual Studio 2015 shell (isolated). I had to repair the Shell to get SSMS to work. In case someone is looking for VS 2015 Shell: LINK
If you cannot find the installer using the above link, the SSMS 17.x installer HERE includes the VS 2015 Shell.
Scott Hanselman has also conveniently included a link to every (>= 2008 R2) Express and SSMS version here: LINK
I had this same issue happen to me when I was stripping my machine of everything Microsoft to refresh my system with 2016-2017 versions of Microsoft products.. First time doing this so I deleted the Visual Studio shell and installed everything 2017 except the 2015 VS shell (not sure if 2017 is out), here was my mistake.
To solve.. first off, make sure you have the Visual Studio Isolated Shell installed. Certain versions of SSMS need a specific version of the shell. My situation called for VS Shell 2015 with my SSMS 2016..
Just installing and repairing the Shell didn't help me completely fix the error. What helped me was deleting a key from my Registry Editor. Run the command regedit from anywhere on your machine and then find:
'HKEY_CURRENT_USER/Software/Microsoft/SQL Server Management Studio/*shellversion*_Config'
Right-click and delete this folder/key. For SSMS 2016 I deleted 13.0_Config.. Right away I was able to open SSMS as usual.
In order to free up some space on my disk, I had uninstalled some programs after which I started getting this error.
I followed all the solutions here, but it didn't fix my problem.
For me, after installing the Visual Studio Shell, I had to delete a key from my registry by following the steps here. Then finally my SSMS started working again.
Quoting from the page:
Start regedit.exe
Go to HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio
Delete 13.0_Config
Restart ssms.exe
All the answers here didn't work for me (SQL Server 2014).
What worked was:
1) Uninstall the Visual Studio 2010 Shell using official installer (not via Programs and Features). The file VSIsoShell.exe can be downloaded here:
https://www.microsoft.com/en-us/download/details.aspx?id=1366
2) Once uninstalled, run SQL Server Installation and hit Repair
Try running SSMS as administrator! After repairing & re-installing multiple components, in the end it was just the security level of my account.
I resolved the problem with SQL Management Studio 2016 by running the VS setup, selecting "Modify" and then installing Extensibility Tools Update 3. After that I just ran SQL Management Studio 2016 and it reset VS Isolated Shell
For all versions of SQL Server, this can be fixed safely with no loss of data including any plugins that may be installed and their data.
This is a common bug, and the solution in all versions of SQL Server is to repair the 'Microsoft Visual Studio 20xx Shell (Isolated)' program installation, which takes about 30 minutes to run unattended.
To perform the repair, please complete the following steps:
Close all instances of Visual Studio.
Press the Windows key.
Type 'Programs'.
Click 'Add or Remove Programs' from the list that appears.
Type 'Shell' into the Search box that appears.
Click 'Microsoft Visual Studio 20xx Shell (Isolated)'*
Click Modify (If greyed out then click Uninstall).
In the window that appears, click 'Repair'.
Wait 30mins or so for repair to complete.
Restart machine.
'Microsoft Visual Studio 20xx Shell (Isolated)' will now be repaired and SQL Server Management Studio should open as normal.
* If there are multiple version(s) of 'Microsoft Visual Studio 20xx Shell (Isolated)' installed, then repair the latest one first, working backwards through versions until the correct program is repaired. Be sure to make a note of the version that fixed your version of SQL Server for future reference as it will not change until smss or vs is upgraded.
I have the same issue after using the custom VS2015 uninstallation tool and installing the VS2017. Repair or reinstall of the SSMS 17.3 does not solve the issue.
To resolve it open the Windows Control panel, select the Programs and Features. Select the Microsoft Visual Studio 2015 Shell (Isolated) from the list and click Change. Then click Repair in the VS setup window. On setup completed ignor the warnings about some newer components already installed. Click Close and thats it! SSMS starts perfect! Hope this save someone's time.
I downloaded VSIsoShell.exe but could not install it. When i deep dive in to error logs the reason is newer version of visual studio exists on the system. I uninstalled vs2017 community then installation of VSIsoShell is successful
Download and Install Visual Studio 2015 Isolated Shell.
You can further read the details of this Redistributable Package from Microsoft Visual Studio
2015 Redistributable Package
You can further Download this Package from this link
After Installing this package, Please run SSMS for SQL SERVER 2016. It actually works for me!
Just in case none of the registry edits or software reinstalls mentioned in the other answers work for you, I was having this issue due to anti-virus. In this case it was Crowdstrike, but others can cause it as well.
Try disabling your AV to test, and if that's the culprit, put an exception in for SSMS 2014/2016.
None of above solutions worked for me , Link in the accepted answer is not working.
So I tried repairing MSSQL 2014 from Setup , This will install Visual Studio Shell which it depends on.
SQL Server Installation Center -> Maintenance -> Repair -> Select the Instance
Next , You will be able to run ssms without an issue.
Hope that works,
I finally got this to work - open up
"C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\RSConfigTool.exe"
then used the repair tools in there, rather than from the control panel install programs (repair).
This seemed to run through reinstalling of files and afterwards everything worked great! I was tearing my hair out!
I uninstalled already existing microsoft visual studio 2010 Shell(isolated) -ENU
Then did repair
To do repair please follow below path : SQL Server Installation Center -> Maintenance -> Repair
Note: None of the above worked for me.This is only worked

SQL server 2012. Exception: attempted to read or write protected memory (MS.VS.OLE.Interop)

I am more an end-user of SQL Server 2012. When I right click on a table name and select "Edit top 200 rows" menu item. I get this message:
Exception has been thrown by the target of an invocation. (mscorlib)
Additional information:
Attempted to read or write protected memory. This is often an indication that
other memory is corrupt. (Microsoft.VisualStudio.OLE.Interop)
If I try to do the right click again, SQL server will stop working and close. I still can use SQL commands to insert or update database. I have been searching around for a solution, and found this link: http://social.msdn.microsoft.com/Forums/vstudio/en-US/42b79da5-6f1e-4122-a2cb-00def87a1ae2/microsoftvisualstudiooleinterop-attempted-to-read-or-write-protected-memory-this-is-often-an?forum=visualstudiogeneral
But it still does not help me to understand clearly the cause or find the solution to the issue. Any help to resolve this problem is highly appreciated. Thanks.
Are you attempting to edit a SQL 2014 database with the 2012 version (or earlier) of SQL Management Studio?
You can determine the SQL version of your database by running this query against your master database:
SELECT ##VERSION
I had the same problem and I was able to direct edit tables ('Edit Top 200') by installing and using SQL Server Management Studio 2014. Even if both your DB and Management Studio are version 2012, it might not hurt to upgrade Management Studio.
I have also faced the same issue. And I noticed one thing that if you are using SQL database newer then the SQL management studio version, You will received that message. To overcome this issue just install SQL management studio equal or greater then version of database. i.e if you have SQL 2012 then you need to install SQL management studio 2012 or 2014.
If anyone experiences the same issue in MS SQL SERVER from a different scenario ( eg - creating new database diagram )
And if this happened after fully uninstalling MS VISUAL STUDIO
Follow the Steps Below;
Delete Folders MSDesigners8 and Visual Database Tools from the paths below.
C:\Program Files (x86)\Common Files\Microsoft Shared\MSDesigners8
C:\Program Files (x86)\Common Files\Microsoft Shared\Visual Database
Tools
Reinstall Visual Studio and Run Repair Tools from the Visual Studio Installer.
This Will Regenerate the folders we removed above and will repair partial fragments.
Now your SQL SERVER Database Diagrams should be working fine. Cheers :)
I have found a solution which does not require restart. Go to:
C:\Users\<User Name>\AppData\Local\Temp
and delete all the files. Before deleting, close the SSMS window.

How can I fix the T-SQL editor in VS 2012 after installing SQL Server 2012 SP1?

I can suddenly no longer open .sql files in VS 2012 by simply double clicking in the Solution Explorer. I get the error message:
Unable to open Transact-SQL file in custom editor
I strongly suspect this is after installing SP1 for SQL Server 2012 Express yesterday, as part of Windows Updates. The error dialogue gives me a link to Get the latest version of SQL Server Data Tools, but that link only yields a Page not found on MSDN.
Installing the SQL Server Data Tools - November 2012 update fixed the SQL editor. All is good in the world again.
Yes, yet another bug in SQL Server 2012 roll eyes
Right click on the SQL file and choose "Open With...".
Choose "Source Code (Text) Editor" and choose "Set as Default".
Now it works again.
Almost a year later, but I found the answer from joerage to be more helpful.
Default to the T-SQL Pane view within Visual Studio 2012 Database Project

How to fix Visual Studio's error "This server version is not supported..." for SQL Server 2012

I recently installed Visual Studio 2010 and SQL Server 2012 on a Windows Server 2008 R2 machine - (including all updates/Service Packs).
When attempting to work on a SQL Server database from within Visual Studio, VS throws the following error:
This server version is not supported. Only servers up to Microsoft SQL
Server 2008 are supported
I recall getting this same error a while back (on a different computer) when I updated a SQL Server 2008 instance to SQL Server 2008 R2. The fix, back then, was to install (or reinstall) Visual Studio 2010 SP1.
Now that I'm receiving this error again (on a new computer), I thought it reasonable to reinstall VS SP1 just like I did a while back. However, doing so did not fix the problem.
It appears as though Visual Studio may need another update to support SQL Server 2012 instances.
For clarity, here are the steps that I did to produce the error: (using VS 2010sp1 and SQL2012)
Using VS, create a Windows Forms application
Right-click the project and choose, Add > New Item
Select "Service-based Database"
Cancel out of the "Data Source Configuration Wizard"
A Database will appear under your Project in Solution Explorer. Double-click the new database
The Database will be added to Server Explorer's list of Data Connections
In Server Explorer, open the database, right-click the Tables directory, then select "Add New Table"
The error "This server version is not supported...." is thrown
Screenshots for whatever its worth..
My question is, is there a fix for this? If so, what is it?
Maybe get SQL Server Data Tools, which work with SQL Server 2012? I believe there are some good tutorials and other materials in the Developer Training Kit. I don't think there are any tricks yet to make an older version of Visual Studio / Data Dude compatible with SQL Server 2012.
Following MSDN blog link discusses about the issue that you are facing with local SQL Server database instance in Visual Studio 2010.
Using LocalDB in Visual Studio 2010
My problem was that I couldn't get VS2012 to work right with SQL Server 2012. I installed the latter product first, but after installing VS2012 and attempting to open an existing project, my existing data file just would not work. I know the software is supposed to automatically take you through a wizard to update your database in the project, but that didn't happen, and I couldn't find a way to make it happen. I'm on the point now of getting rid of SQL Server 2012 and going back to 2008. I'd rather use the most current releases, but I can't spend any more time on configuration issues.
I tried reinstalling the SSDT as well, but kept getting the same error you mentioned Jed, this seemed to let me get around the error message:
http://forums.asp.net/t/1721552.aspx/1?Working+with+Denali+SQLEXPRESS+in+VS+11+Database+issue
This error could also occur if you use the wrong provider. A recently came across the "This server version is not supported...." error and after changing the provider from sqlClient Data Provider to SQL Server Native Client 11.0 in the connection string for the Data Source configuration the problem was solved.
For me, the error arises whenever I try creating a new database. So after unsuccessfully attempting all methods advised, I bypassed the error by clicking on "Add connection" and putting my server name in the dialog box. After adding the non-existent database name, it notifies that it can't find such database and asks whether to create it. Voila! Database created (even though server version is supposedly unsupported).

Resources