You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently playing around with this provider and recently updgraded from the 2.2.X release to the recently merged 3.1.
Until the merge I could use "MyContext.Database.GetAppliedMigrations()" successfully. Now the call raises :
I am not even running a migration. The error came out of the System.Data.Jet\JetCommand.
The SQL statement was "SHOW TABLES WHERE NAME='__EFMigrationsHistory'". As I understand it this is just the code that checks if the history table exists.
I am not even running a migration. The error came out of the System.Data.Jet\JetCommand.
That is definitely odd. If you are not running migrations, what code are you running when the exception is thrown?
Also, please provide us with the full stack trace of the OleDbException.
The full stacktrace: ( I obfuscated some project names but the rest is unchanged)
System.Data.OleDb.OleDbException (0x80040E14): Unzulässige SQL-Anweisung; 'DELETE', 'INSERT', 'SELECT' oder 'UPDATE' erwartet.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteScalar()
at System.Data.Jet.JetCommand.ExecuteScalarCore()
at System.Data.Jet.JetCommand.ExecuteScalar()
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteScalar(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.GetAppliedMigrations()
at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.GetAppliedMigrations(DatabaseFacade databaseFacade)
at Project.UI.ViewModel.DatabaseViewModel.Migrate() in D:\Prototype\Project\Project.UI\ViewModel\DatabaseViewModel.cs:line 41
at Project.UI.ViewModel.DatabaseViewModel.<get_UpdateCommand>b__13_0() in D:\Prototype\Project\Project.UI\ViewModel\DatabaseViewModel.cs:line 81
at Company.UI.Commands.DelegateCommand.<>c__DisplayClass0_0.<.ctor>b__0(Object _) in D:\Prototype\Project\DotNetLib\Company.UI\Commands\DelegateCommand.cs:line 30
at Company.UI.Commands.DelegateCommand`1.Execute(Object pParameter) in D:\Prototype\Project\DotNetLib\Company.UI\Commands\DelegateCommand.cs:line 138
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at Prototype.App.Main()
Okay, so you do call context.Database.GetAppliedMigrations(); after all.
Seems to be just the Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists() call.
I'll take a look at it.
I pulled your fix repo and it seems to resolve the issue I statet here. However something else breaks now: I get en exception from the class DaoSchema constructor line 52 _database = _workspace.OpenDatabase(dataSource, /* Exclusive */ false, /* ReadOnly */ true, string.Empty);:
The repro is exactly same as in the first post.
System.Reflection.TargetInvocationException
HResult=0x80131604
Message=Ein Aufrufziel hat einen Ausnahmefehler verursacht.
Source=mscorlib
StackTrace:
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)
at System.Data.Jet.ComObject.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result) in D:\EntityFrameworkCore.Jet\src\System.Data.Jet\ComObject.cs:line 113
at System.Dynamic.UpdateDelegates.UpdateAndExecute5[T0,T1,T2,T3,T4,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
at System.Data.Jet.DaoSchema..ctor(JetConnection connection) in D:\EntityFrameworkCore.Jet\src\System.Data.Jet\DaoSchema.cs:line 63
at System.Data.Jet.DaoSchema..ctor(JetConnection connection, Boolean naturalOnly) in D:\EntityFrameworkCore.Jet\src\System.Data.Jet\DaoSchema.cs:line 17
at System.Data.Jet.PreciseSchema..ctor(JetConnection connection) in D:\EntityFrameworkCore.Jet\src\System.Data.Jet\PreciseSchema.cs:line 13
at System.Data.Jet.SchemaProvider.CreateInstance(SchemaProviderType type, JetConnection connection) in D:\EntityFrameworkCore.Jet\src\System.Data.Jet\SchemaProvider.cs:line 15
at System.Data.Jet.JetStoreSchemaDefinition.JetInformationSchema.GetTables(JetConnection connection) in D:\EntityFrameworkCore.Jet\src\System.Data.Jet\JetStoreSchemaDefinition\JetInformationSchema.cs:line 109
at System.Data.Jet.JetStoreSchemaDefinition.JetInformationSchema.GetDbDataReaderFromSimpleStatement(JetCommand command) in D:\EntityFrameworkCore.Jet\src\System.Data.Jet\JetStoreSchemaDefinition\JetInformationSchema.cs:line 75
at System.Data.Jet.JetStoreSchemaDefinition.JetInformationSchema.TryGetDataReaderFromInformationSchemaCommand(JetCommand command, DbDataReader& dataReader) in D:\EntityFrameworkCore.Jet\src\System.Data.Jet\JetStoreSchemaDefinition\JetInformationSchema.cs:line 18
at System.Data.Jet.JetCommand.ExecuteScalarCore() in D:\EntityFrameworkCore.Jet\src\System.Data.Jet\JetCommand.cs:line 323
at System.Data.Jet.JetCommand.ExecuteScalar() in D:\EntityFrameworkCore.Jet\src\System.Data.Jet\JetCommand.cs:line 304
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteScalar(RelationalCommandParameterObject parameterObject)
Inner Exception 1:
COMException: Not a valid password.
If this is not related I can also open another issue.
Activity
lauxjpn commentedon Nov 25, 2020
What does the SQL statement with the syntax error exactly look like?
What migration operation of your migration code is failing?
xoniuqe commentedon Nov 25, 2020
I am not even running a migration. The error came out of the System.Data.Jet\JetCommand.
The SQL statement was "SHOW TABLES WHERE NAME='__EFMigrationsHistory'". As I understand it this is just the code that checks if the history table exists.
lauxjpn commentedon Nov 25, 2020
That is definitely odd. If you are not running migrations, what code are you running when the exception is thrown?
Also, please provide us with the full stack trace of the
OleDbException.xoniuqe commentedon Nov 25, 2020
My Code:
The full stacktrace: ( I obfuscated some project names but the rest is unchanged)
lauxjpn commentedon Nov 25, 2020
Okay, so you do call
context.Database.GetAppliedMigrations();after all.Seems to be just the
Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()call.I'll take a look at it.
xoniuqe commentedon Nov 25, 2020
Yes I call the function, then I have missunderstood you.
ChrisJollyAU commentedon Nov 25, 2020
It's in https://github.com/bubibubi/EntityFrameworkCore.Jet/blob/master/src/EFCore.Jet/Migrations/Internal/JetHistoryRepository.cs line 46 function ExistsSql
lauxjpn commentedon Nov 25, 2020
@ChrisJollyAU Yeah, I am already updating the whole file. It is still using the old schema syntax.
ChrisJollyAU commentedon Nov 25, 2020
Outside of the tests it looks like it's the only place that uses it
lauxjpn commentedon Nov 25, 2020
I'll have to do a couple more checks about the
IF EXISTS() THENandIF NOT EXISTS() THENsyntax, manually test some migrations and update the tests.xoniuqe commentedon Nov 26, 2020
I pulled your fix repo and it seems to resolve the issue I statet here. However something else breaks now: I get en exception from the class DaoSchema constructor line 52
_database = _workspace.OpenDatabase(dataSource, /* Exclusive */ false, /* ReadOnly */ true, string.Empty);:The repro is exactly same as in the first post.
If this is not related I can also open another issue.
lauxjpn commentedon Nov 26, 2020
@xoniuqe I moved it to #71.