Entity Framework edmx click on diagram very slow

2020-05-19 00:01发布

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.

4条回答
做自己的国王
2楼-- · 2020-05-19 00:19

This is an issue with Microsoft.VisualStudio.Modeling.Sdk on Windows 10 and also affects the LINQ to SQL (DBML) designer. The team that owns the VS Modeling SDK is currently working on this. We have an issue tracking it on the EF project site https://entityframework.codeplex.com/workitem/2861. We will keep that issue updated with progress, availability of a fix, workarounds, etc.

查看更多
时光不老,我们不散
3楼-- · 2020-05-19 00:20

I can't comment as I'm just under the minimum comment reputation, however I have been having exactly the same issue.

Like you, I re-installed Windows 10 (Enterprise) and Visual Studio (both 2013 Pro and 2015 Pro) to no avail.

For the moment, I've put this on the back-burner and am working around it by using a combination of DevArt's Entity Developer (https://www.devart.com/entitydeveloper/) and manually editing the classes to match database changes.

It is tedious, and not a lot of fun - but it works for me (for the moment).

Hopefully this helps someone.

Edit:

For anyone who may come across this post in the future, the following appears to have solved this issue for me:

  • Navigate to Tools > Options > General
  • Untick "Automatically adjust visual experience based on client performance"
  • Untick "Use graphics acceleration if available"

Though you may not have to, I left "Enable rich client visual experience" unticked.

If this doesn't work, take a look at the comments below this answer - it might be of use. :)

Source: http://pinter.org/?p=2611

Edit 2:

My issue came back, and after further investigation it appears that it was caused by Remote Desktop (I am currently using an ESXi-hosted Windows 10 VM). Switching to VNC or using the VMWare VSphere Web Console results in Visual Studio running perfectly fine. Hopefully this helps someone! :)

查看更多
唯我独甜
4楼-- · 2020-05-19 00:25

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.

查看更多
ら.Afraid
5楼-- · 2020-05-19 00:40

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.

查看更多
登录 后发表回答