title: Entity Framework edmx click on diagram very slow
body: <p>Background first: I have a database-first EF6 model in Visual Studio 2015 (latest nuget 6.1.3 pointing to a local SQL Server 2014 SP1 Express database) on a Windows 10 Pro laptop. After I upgraded from Windows 8.1 and Visual Studio 2013. I also upgraded the model from EF5 about 6 months ago as well, but I don't think this is relevant, as I've also tried rebuilding from scratch.</p>
  
  <p>The model: set of about 100 tables, 50 views and 250 associations.</p>
  
  <p>The problem is every time I want to make changes to my model, any kind of click (left or right) on the <code>.edmx</code> diagram causes Visual Studio to become unresponsive for a few minutes. I've moved everything I can onto another diagram (views with no associations mostly) which does not have this problem, so I'm assuming the number of associations is the problem. Most of these are required foreign key associations pulled in from the database. It is however taking about half an hour to link up 3 FK associations for a view on my main diagram. I can understand if there is a limit on entities in a model, but I can't understand why simply clicking on the diagram should make Visual Studio become unresponsive. The task manager shows heavy CPU usage and no Disk use.</p>
  
  <p>Clicking on any of the entities is fine, as is moving them around or editing them. The problem is clicking on the background canvas.</p>
  
  <p>I have taken to updating the model from the database via the model browser, but I cannot get around using a right-click on the diagram to create new associations.</p>
  
  <p>I've not seen any comments about this problem anywhere. Any suggestions of cause or workarounds?</p>
  
  <p>BTW I have just reinstalled Windows 10 Pro and installed nothing but SQL Server 2014 SP1 Express and Visual Studio 2105 Pro. So there is nothing custom on my system.</p>
  
  <p>UPDATE: ProcDump provides this stacktrace when DevEnv.exe becomes unresponsive, suggesting native code search for graphic objects:</p>
  
  <pre><code>[External Code] 
  [Managed to Native Transition]  
  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.14.0.dll!&lt;Module&gt;.GeoSCursor.search(GeoSCursor* value)
  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.GraphObject.VGGraph.GetObjectsInRect(LRECT bbox, Microsoft.VisualStudio.Modeling.Diagrams.GraphObject.VGLayoutObjectList items, VSGLayoutObject** ignoreItems, int numberItems, int numbertypes, int* types, bool searchSubGraphs)
  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.GraphObject.VGGraph.GetObjectsInRect(LRECT bbox, Microsoft.VisualStudio.Modeling.Diagrams.GraphObject.VGLayoutObjectList items, VSGLayoutObject** ignoreItems, int numberItems, int numbertypes, int* types, bool searchSubGraphs)
  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.GraphObject.VGGraph.get_ObjectsInRectangle(double x0, double y0, double x1, double y1, bool searchSubGraphs)
  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.GraphWrapper.HitTest(Microsoft.VisualStudio.Modeling.Diagrams.RectangleD hitArea, bool requireCompleteContainment, bool searchSubGraphs) 
  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.GraphWrapper.SpatialQuery(Microsoft.VisualStudio.Modeling.Diagrams.GraphWrapper.SpatialDirection direction, Microsoft.VisualStudio.Modeling.Diagrams.ShapeElement currentShape, Microsoft.VisualStudio.Modeling.Diagrams.ShapeElement parentShape)
  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.ShapeElement.FindNextInChildShapes(Microsoft.VisualStudio.Modeling.Diagrams.ShapeElement startFromChildShape, bool focusableRequired)
  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.ShapeAccessibleObject.GetChild(int index)
  System.Windows.Forms.dll!System.Windows.Forms.AccessibleObject.GetFocused()
  System.Windows.Forms.dll!System.Windows.Forms.AccessibleObject.Accessibility.IAccessible.accFocus.get()
  System.Windows.Forms.dll!System.Windows.Forms.InternalAccessibleObject.System.Windows.Forms.UnsafeNativeMethods.IAccessibleInternal.get_accFocus()
  </code></pre>
  
  <p>UPDATE2: XtraSimplicity has a solution which works for some, but not me. Thanks to his suggestions I have ruled this out as a direct graphics driver issue. I have an Intel HD Graphics Family and NVIdia GeForce GT 750M display adapters in my laptop. Intel is the usual active adapter, but the problem also appears when only NVidia is enabled. I've also tried the suggestion of disabling hardware support in Visual Studio, but if anything that just makes the performance of VS when an edmx is open even worse.</p>