msawczyn / EFDesigner2022

Entity Framework visual design surface and code-first code generation for EF6, Core and beyond
MIT License
123 stars 21 forks source link

No diagram Viewer in Visual Studio 2022, just xml code #48

Closed Gerard-91 closed 1 year ago

Gerard-91 commented 2 years ago

I have installed the latest version (4.2.1.3) of the extension in VS 2022, but whenever I double click the .efmodel file VS opens the code, not the editor with the tables and the toolbox. When I right click and select "Open with" there's no "Entity Framework Visual Editor" entry. This happens both for the efmodel file I had from before, and if I add a new efmodel item to the project.

The extension worked well for me in VS2019, and the item was present in the "Open with" dialog.

Is there an additional extension that is required? Should I manually locate the application to use the "open with" dialog? If so, where can I find it.

I manually installed version 4.0.0.6 of the extension and there the diagram is shown 4.0.0 and 4.1.2 work fine 4.2.0 nad 4.2.1 exhibit the problem

Sometimes upon trying to open the file the following error is logged:

2890 ERROR SetSite failed for package [EFModelPackage]Source: 'Sawczyn.EFDesigner.EFModel.DslPackage' Description: Method not found: 'Microsoft.VisualStudio.Threading.JoinableTaskFactory Microsoft.VisualStudio.Shell.AsyncPackage.get_JoinableTaskFactory()'. System.MissingMethodException: Method not found: 'Microsoft.VisualStudio.Threading.JoinableTaskFactory Microsoft.VisualStudio.Shell.AsyncPackage.get_JoinableTaskFactory()'. at Sawczyn.EFDesigner.EFModel.EFModelPackageBase.d1.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Sawczyn.EFDesigner.EFModel.EFModelPackageBase.InitializeAsync(CancellationToken cancellationToken, IProgress1 progress) at Sawczyn.EFDesigner.EFModel.EFModelPackage.InitializeAsync(CancellationToken cancellationToken, IProgress1 progress) at Microsoft.VisualStudio.Shell.AsyncPackage.<>cDisplayClass20_0.<b1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.JoinableTask.d76.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck) {DD1C2EC0-B732-4B74-A591-4D78684BB231} 80131513 VisualStudio 2022/10/05 15:25:00.564
alprinias commented 1 year ago

Hi, confinrming the same here with the latest version, I had 4.1.x before and it was showing correctly.

msawczyn commented 1 year ago

This is an issue with your Visual Studio installation and has been reported for other extensions as well. There's an official response from Microsoft, which I'll add here for posterity:

We have detected that this issue is mostly caused by an invalid copy of the Microsoft.VisualStudio.Shell 
assembly being installed in the GAC. Removing that assembly from the GAC, should solve the issue.

Hope this helps resolve the problem.

Gerard-91 commented 1 year ago

Thanks for pointing that out. Unfortunately it is not the case for me, I've listed the packages in the GAC and there is no reference to Microsoft.VisualStudio.Shell, so Icannot uninstall it.

alprinias commented 1 year ago

Hi,

Although I have not seen the error originally reported in the current issue (just the missing editor from the "open with" dialog) have also run gacutil -l Microsoft.VisualStudio.Shell and nothing was found.

In any case, why would that happen with the latest version only? Is there a way to associate the .efmodel files with the designer "by hand"? If we press the Add button in the "Open with" dialog, what do we need to choose to do so?

Best, Alex

alprinias commented 1 year ago

Dear Michael,

I'm summarizing the problem I have observed. All the following is for VS 2019, Community.

With 4.1.2 it works OK. With 4.2.1 when I double click on the .efmodel, the xml editor opens. no "Entity Framework Visual Editor (Default)" item in the "Open with" dialogue when I right-click on efmodel never seen the originally reported error of the present issue (i.e. never seen "Microsoft.VisualStudio.Shell" reported) If I uninstall 4.2.1 and install 4.1.2 it all works OK again.

If I open a developer's command prompt from Visual Studio and run "gacutil -l Microsoft.VisualStudio.Shell", nothing is found, so this assembly is not in the GAC.

It looks like the installation fails to register the Visual Editor with the .efmodel files. That's why I was asking if there is a way to do it manually. What should be put in this Open With/Add dialog ? OpenWith

Best, Alex

alprinias commented 1 year ago

If this is related to the problem, when 4.2.1 is installed, the extension is disabled. One needs to go in the Extension Manager and enable it. But then there is no visual editor, only the xml.

alprinias commented 1 year ago

It is all fixed in the 4.2.3 nightly build I downloaded and installed today, 14 Nov. 2022. The extension comes up enabled after installation of the .vsix, as it did before 4.2.x. On the other hand, the toolbox items are disabled (greyed out). They were finally enabled after disabling and re-enabling the extension (and restarting VS after each step).

Alex

msawczyn commented 1 year ago

For toolbox issues, that's a pervasive Visual Studio problem. I've kept these links around for when problems occur: