title: Database Diagrams inaccessible after change of Database name
body: <p>I have a SQL server database which I recently renamed through SSMS.
  The database works fine overall, except I can no longer access the Database Diagrams, or create new ones.  Whenever I attempt to do so, I get the following error message -</p>
  
  <pre><code>Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  </code></pre>
  
  <p>How can I regain access to the Database Diagrams, or at the very least, clear them and be able to create new ones again?</p>
  
  <p>EDIT:  I've just noticed that Database Diagrams are not accessible in any of the databases in SQL server, not just the database that was renamed.</p>
  
  <p>The full error message in SQL Server is as follows:</p>
  
  <pre><code>   at Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.QueryStatus(Guid&amp; pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
     at Microsoft.VisualStudio.Platform.WindowManagement.DocumentObjectSite.QueryStatus(Guid&amp; pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.QueryStatus(Guid&amp; pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
     at Microsoft.Internal.VisualStudio.Shell.Interop.IVsTrackSelectionExPrivate.Register()
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConnectSelectionContext()
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.Activate()
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.viewManager_ActiveViewChanged(Object sender, ActiveViewChangedEventArgs e)
     at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
     at Microsoft.VisualStudio.PlatformUI.ExtensionMethods.RaiseEvent[TEventArgs](EventHandler`1 eventHandler, Object source, TEventArgs args)
     at Microsoft.VisualStudio.PlatformUI.Shell.ViewManager.SetActiveView(View view, ActivationType type)
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ShowInternal(ShowFlags showFlags)
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.&lt;Show&gt;b__26()
     at Microsoft.VisualStudio.ErrorHandler.CallWithCOMConvention(Func`1 method)
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.Show()
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.MarshalingWindowFrame.&lt;Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame.Show&gt;b__7a()
     at Microsoft.VisualStudio.Shell.ThreadHelper.Invoke[TResult](Func`1 method)
     at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.MarshalingWindowFrame.Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame.Show()
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con, String fileName)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con, String fileName)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con, String fileName)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.CreateDesignerWindow(IManagedConnection mc, DocumentOptions options)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.InvokeDesigner(IManagedConnection connection)
     at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.Invoke()
     at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ToolsMenuItemBase.MenuInvokedHandler(Object sender, EventArgs args)
  </code></pre>