Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework edmx click on diagram very slow

Tags:

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.

The model: set of about 100 tables, 50 views and 250 associations.

The problem is every time I want to make changes to my model, any kind of click (left or right) on the .edmx 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.

Clicking on any of the entities is fine, as is moving them around or editing them. The problem is clicking on the background canvas.

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.

I've not seen any comments about this problem anywhere. Any suggestions of cause or workarounds?

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.

UPDATE: ProcDump provides this stacktrace when DevEnv.exe becomes unresponsive, suggesting native code search for graphic objects:

[External Code]  [Managed to Native Transition]   Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.14.0.dll!<Module>.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() 

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.

like image 279
Tree Avatar asked Nov 22 '15 12:11

Tree


People also ask

How do I open an EDMX file in diagram?

Right-click on your EDMX file, select Open With…, then select XML (Text) Editor. Boom, there is your entire EDMX file as Visual Studio and . Net sees it, in all its XML wonderfulness.

What is EDMX file in Entity Framework?

edmx file is an XML file that defines an Entity Data Model (EDM), describes the target database schema, and defines the mapping between the EDM and the database. An . edmx file also contains information that is used by the ADO.NET Entity Data Model Designer (Entity Designer) to render a model graphically.

Does EF core support EDMX?

EF Core does not support the EDMX file format for models. The best option to port these models, is to generate a new code-based model from the database for your application.


2 Answers

We had the same issue on 2 laptops with Windows 10 and touchscreens. Killing the process TabTip.exe seems to solve the issue.

Source: https://connect.microsoft.com/VisualStudio/Feedback/Details/2011437

Go Task Manager and End Process on TabTip.exe (Touch Keyboard and Handwriting Panel). After doing that the designer will respond fine. Note if you click or touch the Keyboard icon in the TaskBar the TabTip.exe will re-start.

like image 70
Claudio Cauchi Avatar answered Oct 15 '22 04:10

Claudio Cauchi


I tried the accepted answer and it did work for me, however the issue returned on restart. I also tried the other answers with no success. I found the offending windows service and used Windows 10 services management screen to disable the service. I hope this is helpful to others with this issue.


How to disable the service fully

Disable the service:

  1. User windows start search (by the start menu) and type in: Services
  2. You should see a windows desktop app called Services (open it).
  3. Find the services called "Touch Keyboard and Handwriting Panel Service".
  4. Open its properties, (by right clicking it).
  5. Under the General tab set the startup type to "Disabled".
  6. Stop the service if if it has not stooped already.

Verification:

  1. Open Visual Studio's EDMX and you should notice the difference right-away, if not then you may not have the same issue as me.
  2. Restart your computer and test the EDMX again, it should not be slow.

Note: This does mess with your gesture and touch pad a bit, so if you use that a lot then don't do this. This guide is for windows 10, and worked for me but may not work for you. Also I have not tested if Windows update will re-enable the service.

like image 38
Gram Avatar answered Oct 15 '22 02:10

Gram