Thank you, Sebastien. I have submitted bug 7354. Another work-around is to simply have my app call String.Contains (and all other methods needed by TypeSystem static constructor). The linker does not remove these methods if they are explicitly used.
On Mon, Sep 17, 2012 at 12:38 PM, Sebastien Pouliot <[email protected]>wrote: > Hello Len, > > On Mon, Sep 17, 2012 at 3:13 PM, Len Charest <[email protected]> wrote: > > When running on a device, my app is throwing a > TypeInitializationException > > from the static constructor for > System.Data.Services.Client.TypeSystem.The > > constructor is attempting to populate a Dictionary<MethodInfo, string> > and > > failing on the lookup of method info for String.Contains(String); see > > TypeSystem.cs, line 42. This code works fine on the simulator. > > > > I'm hitting the error when my app tries to do the following: > > > > var context = new MyDataServiceContext(myServiceRoot); // context class > > generated by dataSvcUtil.exe > > var query = context.Users.AddQueryOption("$filter", "Username eq > 'bob'"); // > > query is a DataServiceQuery<User> > > var uri = query.RequestUri; > > > > The getter for RequestUri starts a call chain that eventually hits > > TypeSystem.GetElementType, which thereby triggers the static constructor. > > > > Any ideas? > > It seems that System.Data.Services.Client.dll depends a lot of > reflection. By default linking is disabled on the simulator so almost* > everything is available at runtime. However the default, for devices, > is to enable the linker (small app size and faster builds) and this > can remove some of the methods (or even types) that SDSC.dll might > need. > > A very quick turn around is to disable the linker (no link). That will > allow you to resume development / testing on device. Please fill a bug > report on bugzilla.xamarin.com and we'll look to fix this and give you > a better workaround until this fix is released. > > Regards, > Sebastien > > * not the parts about Microsoft.VisualBasic.* >
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
