Bug 60733 - SQLiteCommandbuilder Error
Summary: SQLiteCommandbuilder Error
Alias: None
Product: Android
Classification: Xamarin
Component: Bindings ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Atsushi Eno
Depends on:
Reported: 2017-11-17 16:03 UTC by josepen@microsoft.com
Modified: 2017-12-05 15:43 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Project that repro the issue (9.13 KB, application/x-zip-compressed)
2017-11-17 16:03 UTC, josepen@microsoft.com

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 60733 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description josepen@microsoft.com 2017-11-17 16:03:46 UTC
Created attachment 25746 [details]
Project that repro the issue

I created a Table with Key in SQLite Android.mono.
After that they used a SqliteCommand and a SqliteDataAdapter to fill the Dataset, then used a SqliteCommandbuilder to generate an Update Command, but it doesnt work.
The error that they are seeing is the below:
System.InvalidOperationException: Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information.
at System.Data.Common.DbCommandBuilder.BuildInformation (System.Data.DataTable schemaTable) [0x00119] in <868a6461786e4884ac572c5e90a6b7fd>:0 
at System.Data.Common.DbCommandBuilder.BuildCache (System.Boolean closeConnection, System.Data.DataRow dataRow, System.Boolean useColumnsForParameterNames) [0x0011b] in <868a6461786e4884ac572c5e90a6b7fd>:0 
at System.Data.Common.DbCommandBuilder.GetUpdateCommand (System.Data.DataRow dataRow, System.Boolean useColumnsForParameterNames) [0x00000] in <868a6461786e4884ac572c5e90a6b7fd>:0 
at System.Data.Common.DbCommandBuilder.GetUpdateCommand (System.Boolean useColumnsForParameterNames) [0x00000] in <868a6461786e4884ac572c5e90a6b7fd>:0 
at Mono.Data.Sqlite.SqliteCommandBuilder.GetUpdateCommand (System.Boolean useColumnsForParameterNames) [0x00000] in <20d4030d941e4282a6d6f057ee33637d>:0 
at (wrapper remoting-invoke-with-check) Mono.Data.Sqlite.SqliteCommandBuilder:GetUpdateCommand (bool)
at sqlitetest.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x000df] in C:\Users\Sven\documents\visual studio 2017\Projects\sqlitetest\sqlitetest\MainActivity.cs:46
Comment 1 Marek Safar 2017-11-20 17:59:05 UTC
This works for me with Mac version of sqlite so perhaps this is Android version specific issue
Comment 2 Jon Douglas [MSFT] 2017-11-27 16:49:21 UTC
Hi Jose,

Thanks for the bug report. 

To further diagnose this issue, we will need to know the following items:

1. What is your environment information? Does this only occur on Windows?

See #6 of the following guide: https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/howto-file-bug/#Best_practices_to_help_Xamarin_address_bugs_quickly_and_efficiently

2. What device or emulator does this occur with?

I did a quick run through of the code, and it looks like you are "catching" the exception in question. In the future, please ensure that your test case is self contained and reproduces the issue rather than catching it and not exposing it directly from a "build and run" scenario.

I was able to reproduce this issue:

11-27 08:59:17.309 E/mono    ( 4538): Unhandled Exception:
11-27 08:59:17.309 E/mono    ( 4538): System.InvalidOperationException: Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information.
11-27 08:59:17.309 E/mono-rt ( 4538): [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information.

It looks like this question was asked previously on Stack Overflow and the Forums with the exact same code:



(In the future please also link to any known items like this if you know about them!)

At first glance this seems like an Android specific deviation(with use of APIs) or limitation of the Mono.Data.SQLite assembly.

I am CONFIRMING this for the time being as it's reproducible on Windows and Mac. on the latest Stable.
Comment 3 MintDeville 2017-12-05 15:40:04 UTC

i found that bug and posted the code to the 2 Forums in your comment.
I had the Bug on a Samsung S7 and a Zebr TC51.

I ported the same code to a normal Windows app where it works like expected.
I Copied the Database from the device to the PC and the Database worked on the PC.

My guess is, that the Sqlitecommand doesnt provide any shema information, even when specifically asked for.
Comment 4 MintDeville 2017-12-05 15:43:04 UTC
Its a Zebra TC51.

Since you already reproduced the Error, I dont think I can provide you with anything else, but if you have a specific Question, just ask.