Error in Linq with PCL with Xamarin Forms

(hamberg) #1


I am making a very simple .net xamarin form app for ios using a Portable Class Library with Data Abstracts. I am using VS2017 and I create a xamarin forms cross platform app. I then add a new project to the solution and choose Data Abstracts Portable Class Library. I then use the wizard and connect to my relativity server with superhttps with tls. My DataAbstracts.dll is I then try to get a simple list from a table.

I can get the same code working in a windows desktop app connecting to this relativity server just not a PCL app.

        var relativityQuery = from c in fRemoteDataAdapter.GetTable<testTable>()
                              orderby c.MyDescription
                              select c;
        var myList = relativityQuery.ToList();

When the code hits var myList = relativityQuery.ToList(); it errors with the following:

Blocking LINQ query execution not supported, use RDA.BeginExecute

What can I do to troubleshoot this?


(antonk) #2


You need to use async access methods (just as the error message says)

Please take a look at this message and below:

(hamberg) #3

Hello antonk,

I ran this code from your example:

var query = from x in fRemoteDataAdapter.GetTable() select new { x.LastName, x.FirstName /* list all columns here */ };
var myList = await fRemoteDataAdapter.LoadListAsync(query);

And now it comes back with “SessionNotFoundException”. on the AppDelegate in the IOS project even though it has an error handler set on the sub.

It looks like it is not running the login automatically (through events) like it does in in a winform app. I tried passing the login information before I did the select with var boolLogin = LogOnAsync(“TestUser”, “Password”) but that did not work as well. Do you have anything else can I try?

I am really just trying to get a standard xamarin form basic template working with PLC of DataAbstracts. I am now also looking at trying fire on my mac and then using data abstracts from there. I hope they have some templates to get started for doing c# with ios and a relativity server. I have a simple project I am trying to do and then build on to it from there.

Thanks again.


(antonk) #4

This is not entirely correct. You need to call it as

var boolLogin = await LogOnAsync(“TestUser”, “Password”);

Otherwise it is just an async operation that doesn’t completes when you run the query part.

Do you have the event not firing at all or it is fired and just doesn’t process the login process due to a missing await keyword?

Just post your questions and we’ll be happy to help.

(marc hoffman) #5

Not templates per se, the idea being that most people want to add DA connectivity to any kind of existing (or new) project type. You will want to check out the “Tools|Remoting SDK and Data Abstract|Connect to Relativity Server…” menu, and also check out… (i’m embarrassed to see that this docs topic should cover this, but doesn’t yet — but it should be self-explanatory; i’ll make a nite to get those topics written soon though).

FWIW, IMHO a native Cocoa app is definitely the way to go over Xamarin — whether with Fire (i hope so ;)) or even just plain Xcode + DA/Cocoa.

(hamberg) #6

Thank you antonk,

I tried with the await and it still just breaks without being caught in the handler. It has been driving me crazy that it works fine in the desktop app. Since I really don’t know xamarin all that much I am going to give rem c# / hydro a try. I am going to try Marcs option below to see if I have any luck. Thanks you for your help.

(RemObjects) #7

Thanks, logged as bugs://78684