I suspect that the linker - which is a bit more agressive when you build for the device I think - is stripping out ISqlDataContext, so when you change it, you are telling the compiler that it needs to not strip that out.
try this: ISqlDataContext foo = null; var provider = (IDataContextProvider<IDataContext>) new SqlDataContextProvider(); <---- the old offending line (and maybe foo = provider just to be sure) see if that works - I suspect it will. On Mon, Jul 25, 2011 at 22:12, [email protected] <[email protected]> wrote: > Just press the button in the test app and it crashes, without even giving the > possibility to debug the code. > > This instruction cause the problem: > > IDataContextProvider<IDataContext> provider = > (IDataContextProvider<IDataContext>) new SqlDataContextProvider(); > > that shortened is: > > var provider = (IDataContextProvider<IDataContext>) new > SqlDataContextProvider(); > > if instead of > (IDataContextProvider<IDataContext>) > is used > (IDataContextProvider<ISqlDataContext>) > it works (no covariance needed). > > > > -- > View this message in context: > http://monotouch.2284126.n4.nabble.com/Covariance-working-on-simulator-but-crashing-on-device-tp3693885p3694101.html > Sent from the MonoTouch mailing list archive at Nabble.com. > _______________________________________________ > MonoTouch mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/monotouch > -- Nic Wise t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise b. http://www.fastchicken.co.nz/ mobileAgent (for FreeAgent): get your accounts in your pocket. http://goo.gl/IuBU Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2 _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
