I am using Entity Framework 5.0 database first approach and I am unable to update model (edmx in Model browser) from database in Visual Studio 2022.
I have 3 models inside my solution and I am able to update other 2 that uses the same EF 5.0 as the one that throws exception (see below).
I am able to update the same model downloaded from same source control on any other computer or even on the same computer in Visual Studio 19. Normally I am using VS 22 so I guess something went wrong during normal usage.
System.Data.Entity.Core.EntityCommandCompilationException: An error occurred while preparing the command definition. See the inner exception for details. ---> System.NotImplementedException: The method or operation is not implemented.
at Microsoft.Data.Entity.Design.VersioningFacade.LegacyProviderWrapper.LegacyDbExpressionConverter.Visit(DbApplyExpression expression)
at Microsoft.Data.Entity.Design.VersioningFacade.LegacyProviderWrapper.LegacyDbExpressionConverter.Visit(DbProjectExpression expression)
at Microsoft.Data.Entity.Design.VersioningFacade.LegacyProviderWrapper.LegacyDbExpressionConverter.Visit(DbFilterExpression expression)
at Microsoft.Data.Entity.Design.VersioningFacade.LegacyProviderWrapper.LegacyDbExpressionConverter.Visit(DbProjectExpression expression)
at Microsoft.Data.Entity.Design.VersioningFacade.LegacyProviderWrapper.LegacyDbProviderServicesWrapper.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)
--- End of inner exception stack trace ---
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)
at System.Data.Entity.Core.EntityClient.EntityCommand.CreateCommandDefinition()
at System.Data.Entity.Core.EntityClient.EntityCommand.TryGetEntityCommandDefinitionFromQueryCache(EntityCommandDefinition& entityCommandDefinition)
at System.Data.Entity.Core.EntityClient.EntityCommand.GetCommandDefinition()
at System.Data.Entity.Core.EntityClient.EntityCommand.InnerPrepare()
at System.Data.Entity.Core.EntityClient.EntityCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadDataTable[T](String sql, Func`2 orderByFunc, DataTable table, EntityStoreSchemaFilterObjectTypes queryTypes, IEnumerable`1 filters, String[] filterAliases)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadRelationships(IEnumerable`1 filters)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadStoreSchemaDetails(IList`1 filters)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GetStoreSchemaDetails(StoreSchemaConnectionFactory connectionFactory)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.CreateStoreModel()
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GenerateModel(List`1 errors)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModel(ModelBuilderSettings settings, IVsUtils vsUtils, ModelBuilderEngineHostContext hostContext)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Gui.WizardPageBase.GenerateModel(ModelBuilderSettings settings)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Gui.WizardPageUpdateFromDatabase.OnWizardFinish()
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Gui.ModelBuilderWizardForm.OnFinish()
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I tried deleting all code and downloading it again from source control, repairing VS 22 through Visual Studio Installer, restarting computer and VS.