Bug 12039 - Tasky throws System.NotSupportedException: Cannot compile: Parameter
Summary: Tasky throws System.NotSupportedException: Cannot compile: Parameter
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Samples ()
Version: 4.6.x
Hardware: PC Mac OS
: High normal
Target Milestone: ---
Assignee: Ben O'Halloran
URL:
Depends on:
Blocks:
 
Reported: 2013-04-30 05:59 UTC by Prashant Cholachagudda
Modified: 2014-07-31 13:53 UTC (History)
6 users (show)

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

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Prashant Cholachagudda 2013-04-30 05:59:34 UTC
Task throws a System.NotSupportedException when we query tasks.
Reported on Forum here: http://forums.xamarin.com/discussion/comment/10071/#Comment_10071
and customer case.
Comment 2 Miguel de Icaza [MSFT] 2013-05-22 14:36:56 UTC
Issuing a "Clean all" should fix this, according to the forums
Comment 3 Argentina - Gonzalo 2013-07-16 08:28:56 UTC
good morning!
I have the same problem, when open a saved task I receive "System.NotSupportedException: Cannot compile: Parameter".

The solution "Clean all" not work for me.

Anyone knows a possible solution??
Comment 4 Stefan Schoeb 2014-01-10 08:39:06 UTC
Got this problem with a normal MvvmCross project when trying to use the SQLite database.

Here a sample project where you can reproduce it:
https://github.com/sschoeb/bug12039

Here the Exception:
An unhandled exception occured.
01-10 13:31:50.297 I/dalvikvm( 3283): threadid=3: reacting to signal 3
01-10 13:31:50.297 I/dalvikvm( 3283): Wrote stack traces to '/data/anr/traces.txt'
01-10 13:31:50.757 I/MonoDroid( 3283): UNHANDLED EXCEPTION: System.NotSupportedException: Cannot compile: Parameter
01-10 13:31:50.757 I/MonoDroid( 3283): at SQLite.TableQuery`1<Bug.Core.DemoModel>.CompileExpr (System.Linq.Expressions.Expression,System.Collections.Generic.List`1<object>) <0x0291f>
01-10 13:31:50.757 I/MonoDroid( 3283): at SQLite.Tabl01-10 13:31:50.757 I/MonoDroid( 3283): at SQLite.TableQuery`1<Bug.Core.DemoModel>.CompileExpr (System.Linq.Expressions.Expression,System.Collections.Generic.List`1<object>) <0x0076b>
01-10 13:31:50.757 I/MonoDroid( 3283): at SQLite.TableQuery`1<Bug.Core.DemoModel>.CompileExpr (System.Linq.Expressions.Expression,System.Collections.Generic.List`1<object>) <0x01df7>
01-10 13:31:50.757 I/MonoDroid( 3283): at SQLite.TableQuery`1<Bug.Core.DemoModel>.CompileExpr (System.Linq.Expressions.Expression,System.Collections.Generic.List`1<object>) <0x001e3>
01-10 13:31:50.757 I/MonoDroid( 3283): at SQLite.TableQuery`1<Bug.Core.DemoModel>.GenerateCommand (string) <0x00217>
01-10 13:31:50.757 I/MonoDroid( 3283): at SQLite.TableQuery`1<Bug.Core.DemoModel>.GetEnumerator () <0x00047>
01-10 13:31:50.757 I/MonoDroid( 3283): at System.Collections.Generic.List`1<Bug.Core.DemoModel>.AddEnumerable (System.Collections.Generic.IEnumerable`1<Bug.Core.DemoModel>) <0x0004c>
01-10 13:31:50.757 I/MonoDroid( 3283): at System.Collections.Generic.List`1<Bug.Core.DemoModel>..ctor (System.Collections.Generic.IEnumerable`1<Bug.Core.DemoModel>) <0x0012b>
01-10 13:31:50.757 I/MonoDroid( 3283): at System.Linq.Enumerable.ToList<Bug.Core.DemoModel> (System.Collections.Generic.IEnumerable`1<Bug.Core.DemoModel>) <0x00067>
01-10 13:31:50.757 I/MonoDroid( 3283): at Bug.Core.DatabaseService.GetAll<Bug.Core.DemoModel> () <0x00313>
01-10 13:31:50.757 I/MonoDroid( 3283): at Bug.Core.ViewModels.FirstViewModel/<>c__DisplayClass2.<.ctor>b__0 () [0x00000] in c:\Projects\Bug12039\Bug.Core\ViewModels\FirstViewModel.cs:10
01-10 13:31:50.757 I/MonoDroid( 3283): at Cirrious.MvvmCross.ViewModels.MvxCommand.Execute (object) <IL 0x0000f, 0x00050>
01-10 13:31:50.757 I/MonoDroid( 3283): at Cirrious.MvvmCross.Binding.Bindings.Target.MvxEventHandlerEventInfoTargetBinding.HandleEvent (object,System.EventArgs) <IL 0x0000f, 0x00041>
01-10 13:31:50.757 I/MonoDroid( 3283): at Android.Views.View/IOnClickListenerImplementor.OnClick (Android.Views.View) [0x0000d] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/c789d807/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Views.View.cs:885
01-10 13:31:50.757 I/MonoDroid( 3283): at Android.Views.View/IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/c789d807/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Views.View.cs:852
01-10 13:31:50.757 I/MonoDroid( 3283): at (wrapper dynamic-method) object.54e28eab-1bbc-4f70-ac2d-f9ca87506ed2 (intptr,intptr,intptr) <IL 0x00017, 0x0001f>
Unhandled Exception:

System.NotSupportedException: Loading...
01-10 13:31:52.977 E/mono    ( 3283): 
01-10 13:31:52.977 E/mono    ( 3283): Unhandled Exception:
01-10 13:31:52.977 E/mono    ( 3283): System.NotSupportedException: Cannot compile: Parameter
01-10 13:31:52.977 E/mono    ( 3283):   at SQLite.TableQuery`1[Bug.Core.DemoModel].CompileExpr (System.Linq.Expressions.Expression expr, System.Collections.Generic.List`1 queryArgs) [0x00000] in <filename unknown>:0 
01-10 13:31:52.977 E/mono    ( 3283):   at SQLite.TableQuery`1[Bug.Core.DemoModel].CompileExpr (System.Linq.Expressions.Expression expr, System.Collections.Generic.List`1 queryArgs) [0x00000] in <filename unknown>:0 
01-10 13:31:52.977 E/mono    ( 3283):   at SQLite.TableQuery`1[Bug.Core.DemoModel].CompileExpr (System.Linq.Expressions.Expression expr, System.Collections.Generic.List`1 queryArgs) [0x00000] in <filename unknown>:0 
The program 'Mono' has exited with code 0 (0x0).


My system:
Win 8 64 Bit
Xamarin.Android 4.11.00217
Xamarin.iOS 1.10.30

Clean does not change anything.
 
The evil-Code is actually this: (does not really make sense.. but that's not the point :-P)
public List<T> GetAll<T>() where T : new() 
{
    using (var connection = _connectionFactory.Create("db"))
    {
        return connection.Table<T>().Where(x => x.ToString().Length > 0).ToList();
    }
}

Removing the Where-Statement does actually fix the problem...
Comment 5 Oleg Demchenko 2014-01-14 12:28:02 UTC
Can't reproduce System.NotSupportedException with next steps:
1) Click "Add task" 
2) Input name and notes and hit "Save"
3) Open saved task

Screencast: http://screencast.com/t/PmA4QjxbJPJH

Environment details:
OS X 10.9.1
XS Version 4.2.2
MFA 4.10.1
Comment 6 Oleg Demchenko 2014-01-15 16:45:47 UTC
Reproduced with Stefan's sample, set this CONFIRMED status.

Environment details:
OS X 10.9.1
XS Version 4.2.2
Xamarin.Android 4.10.2
Comment 7 Jonathan Pryor 2014-01-16 12:03:05 UTC
This is pretty clearly a bug in the SQLite-net lib included within Tasky, as the top of the stack trace is SQLite.TableQuery`1<Bug.Core.DemoModel>.CompileExpr():

https://github.com/xamarin/mobile-samples/blob/master/Tasky/Tasky.Core.MD/DL/SQLite.cs#L1336

This certainly is not a Xamarin.Android bug.

SQLite-net has changed; current master is 3060 LOC vs. the 1667 within Tasky:

https://github.com/praeclarum/sqlite-net/blob/master/src/SQLite.cs

I would suggest updating SQLite-net and see if that fixes the issue reported in Comment #4.
Comment 8 Marek Habersack 2014-07-31 13:53:32 UTC
Not reproducible using the current tip of master