System.InvalidCastException on SubmitChange

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
mclaus
Posts: 3
Joined: Tue 12 Jul 2016 20:06

System.InvalidCastException on SubmitChange

Post by mclaus » Tue 12 Jul 2016 20:20

Hi - I am new to both SQLite and LINQ, but I'm evaluating the Devart LinqConnect product for developing a mid-size Visual Basic application using SQlite. I'm working in Visual Studio 2015. I've developed a small (almost trivial) test application that I can use to evaluate the product. It is a small DB with 2 tables - a master and a detail table. A single form displays the master-detail entries in the DB with a pair of data-bound datagrid controls. Works fine, except whenever I attempt to add a record to the details tables, I get an error when the SubmitChanges call is made.

I'm receiving the following exception when I perform a SubmitChanges on my small test database

Any ideas on what I need to change?

----------------------------------------------------------------------------
System.InvalidCastException was unhandled
HResult=-2147467262
Message=Unable to cast object of type 'Devart.Data.Linq.Engine.ProviderType' to type 'Devart.Data.SQLite.Linq.Provider.SQLiteProviderType'.
Source=Devart.Data.SQLite.Linq
StackTrace:
at Devart.Data.SQLite.Linq.Provider.SQLiteDataProvider.ProcessParameterValue(DbParameter parameter, Type clrType, ProviderType providerType, Object value)
at Devart.Data.Linq.DataProvider.ApplyParameter(DbParameter parameter, String name, ParameterDirection direction, ProviderType providerType, Type clrType, Object parameterValue)
at Devart.Data.Linq.DataProvider.b(String A_0, IEnumerable`1 A_1, IEnumerable`1 A_2, Boolean A_3)
at Devart.Data.Linq.DataProvider.a(String A_0, IEnumerable`1 A_1, IEnumerable`1 A_2, Boolean A_3)
at Devart.Data.Linq.Engine.SubmitCommandBuilder.a(String A_0, IEnumerable`1 A_1, IEnumerable`1 A_2, Boolean A_3)
at Devart.Data.Linq.Engine.SubmitCommandBuilder.a(IObjectEntry A_0)
at Devart.Data.Linq.Engine.bz.c(IObjectEntry A_0)
at Devart.Data.Linq.Engine.bz.a(IObjectEntry[] A_0, ConflictMode A_1, a A_2)
at Devart.Data.Linq.Engine.bz.a(ConflictMode A_0)
at Devart.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
at Devart.Data.Linq.DataContext.SubmitChanges()
at LinqPlay2.DatabaseForm.SaveButton_Click(Object sender, EventArgs e) in C:\Users\Mike\documents\visual studio 2015\Projects\LinqPlay2\LinqPlay2\DatabaseForm.vb:line 185
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.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.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at LinqPlay2.MainForm.ShowForm(TF_DISPLAY_MODE mode) in C:\Users\Mike\documents\visual studio 2015\Projects\LinqPlay2\LinqPlay2\MainForm.vb:line 29
at LinqPlay2.MainForm.ManageFilesButton_Click(Object sender, EventArgs e) in C:\Users\Mike\documents\visual studio 2015\Projects\LinqPlay2\LinqPlay2\MainForm.vb:line 19
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.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.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at LinqPlay2.My.MyApplication.Main(String[] Args) in :line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: System.InvalidCastException on SubmitChange

Post by Shalex » Wed 13 Jul 2016 15:55

Please send us a small test project with the corresponding test database for reproducing.

mclaus
Posts: 3
Joined: Tue 12 Jul 2016 20:06

Re: System.InvalidCastException on SubmitChange

Post by mclaus » Wed 13 Jul 2016 16:37

Hi - thanks for the offer to check this out. I uploaded my test program and the associated test DB to the folder '178752' on the Devart FTP server.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: System.InvalidCastException on SubmitChange

Post by Shalex » Mon 18 Jul 2016 06:27

Thank you for the test project. We have reproduced the error and are investigating the issue. We will notify you about the result.

mclaus
Posts: 3
Joined: Tue 12 Jul 2016 20:06

Re: System.InvalidCastException on SubmitChange

Post by mclaus » Thu 28 Jul 2016 15:40

Did you ever learn what was going on with this? My evaluation with Devart is about to expire. I'd like to at least get this one question sorted out.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: System.InvalidCastException on SubmitChange

Post by Shalex » Tue 02 Aug 2016 14:23

Please open your *.lqml model and change the type of the TreatmentFileParameter.Value property from System.Object to any other type (e.g.: System.String).

System.Object doesn't work for this scenario at the moment. There is no any timeframe for the fix.

Post Reply