I have created a SDK client in Monotouch (.993). Retrieving simple types like date and string works fine. Now I want to retrieve an array of a struct (which only has simple types), but now I get a TypeLoadException
{System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool) at System.Reflection.Assembly.GetTypes () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/Assembly.cs:357 at RemObjects.SDK.TypeManager.FindType (System.String typeName) [0x00000] in :0 at RemObjects.SDK.TypeManager.CreateInstanceOfType (System.String typeName) [0x00000] in :0 at RemObjects.SDK.BinSerializer.ReadComplex (System.String aName, System.Type aType) [0x00000] in :0 at RemObjects.SDK.Serializer.Read (System.String name, System.Type type, StreamingFormat format) [0x00000] in :0 at RemObjects.SDK.BinSerializer.ReadArray (System.String iName, System.Type iType, StreamingFormat aFormat) [0x00000] in :0 at RemObjects.SDK.Serializer.Read (System.String name, System.Type type, StreamingFormat format) [0x00000] in :0 at RemObjects.SDK.Message.Read (System.String aName, System.Type aType, StreamingFormat aFormat) [0x00000] in :0 at POCtest.ROServer2Service_Proxy.RequestKlanten (System.String aID, POCtest.KlantRec[]& data) [0x0004d] in /Users/hlogmans/Mobile/TestROServer/iOS/ROServer2Library_Intf.cs:218 at POCtest.Testlist.Start () [0x0001e] in /Users/hlogmans/Mobile/TestROServer/iOS/POC-test/Testlist.cs:72 at POCtest.Testlist.m__0 () [0x00000] in /Users/hlogmans/Mobile/TestROServer/iOS/POC-test/Testlist.cs:45 at MonoTouch.Dialog.StringElement.Selected (MonoTouch.Dialog.DialogViewController dvc, MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) [0x0000b] in /Developer/MonoTouch/Source/MonoTouch.Dialog/MonoTouch.Dialog/Elements.cs:689 at MonoTouch.Dialog.DialogViewController.Selected (MonoTouch.Foundation.NSIndexPath indexPath) [0x00029] in /Developer/MonoTouch/Source/MonoTouch.Dialog/MonoTouch.Dialog/DialogViewController.cs:518 at MonoTouch.Dialog.DialogViewController+Source.RowSelected (MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) [0x00019] in /Developer/MonoTouch/Source/MonoTouch.Dialog/MonoTouch.Dialog/DialogViewController.cs:364 at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29 at POCtest.Application.Main (System.String[] args) [0x00000] in /Users/hlogmans/Mobile/TestROServer/iOS/POC-test/Main.cs:17 }
In the details there are two lines:
{System.TypeLoadException: Could not load type ‘IpHttpClientRequest’ from assembly ‘RemObjects.SDK.MonoTouch, Version=6.0.57.993, Culture=neutral, PublicKeyToken=null’.}
{System.TypeLoadException: Could not load type ‘RemObjects.SDK.SuperTcpChannelWorker’ from assembly ‘RemObjects.SDK.MonoTouch, Version=6.0.57.993, Culture=neutral, PublicKeyToken=null’.}
I did not recompile the sources, just took the dlls from the mono touch folder from my windows machine. And a few lines earlier the connection works OK.
These are the sources, it failes at the end:
using System; using System.Collections.Generic; using System.Linq; using MonoTouch.Foundation; using MonoTouch.UIKit; using MonoTouch.Dialog; using RemObjects.SDK; //using RemObjects.SDK; namespace POCtest { public partial class Testlist : DialogViewController { public EntryElement ServerIdElement { get; set; } public StringElement ServerTxtElement { get; set; } public Section KlantenSection { get; set; } public WinInetHttpClientChannel channel { get; private set; } public BinMessage message { get; private set; } public IROServer2Service service { get; private set; } public Testlist () : base (UITableViewStyle.Grouped, null) { //TypeManager.TypeAssemblies.Add(typeof(POCtest.Testlist)); channel = new RemObjects.SDK.WinInetHttpClientChannel (); channel.TargetUrl = "http://192.168.0.16:9503/bin"; message = new RemObjects.SDK.BinMessage (); service = CoROServer2Service.Create (message, channel); //service = (new RemObjects.SDK.RemoteService(message, channel, false, )) ; //dta. DateTime dt = service.GetServerTime (); Root = new RootElement ("Testlist"); Section se = new Section ("Eerste sectie"); se.Add (new StringElement ("Start", () => { Start (); })); ServerIdElement = new EntryElement ("Server ID", "ID", String.Empty); se.Add (ServerIdElement); ServerTxtElement = new StringElement ("Server txt", ""); se.Add (ServerTxtElement); se.Add (new StringElement ("Serverdate", dt.ToLongTimeString ())); KlantenSection = new Section ("Klanten"); Root.Add (se); Root.Add (KlantenSection); } void Start () { ServerIdElement.FetchValue (); String resvalue = ""; if (service.RequestData (ServerIdElement.Value, out resvalue)) { // success ServerTxtElement.Value = resvalue; } else { // failure ServerTxtElement.Value = resvalue; } KlantRec[] klijst = null; KlantenSection.Clear (); if (service.RequestKlanten (ServerIdElement.Value, out klijst)) { /// <<<<<<<<============== foreach (KlantRec k in klijst) { KlantenSection.Add (new StyledStringElement (k.Naam, k.Adres, UITableViewCellStyle.Subtitle)); } } ReloadData (); } } }