Thank you for the answer.

1. I have already disabled linking.

I'll try to sum up the exact scenarios.

Working:
Release Build, no linking, not using shared runtime
Deploying to device from VS (hitting F5)
Everything is working completely as it should

Not working:
Release Build, no linking, not using shared runtime
Deploy to device following this procedure:
Deploy by hitting F5 in VS. After APK is created, sign the APK located in 
'SolutionFolder'\'ProjectName'\bin\Release\App.APK
Copy the signed App.apk to the device' SD card
Browse the SD card. Install the APK.
Run the installed application.

Now from this point I've found several things happening:
System.Timers.Timer.Enable makes the app return a ANR (not seen this a single 
time when deploying/debugging from VS)
System.Net.WebClient is unable to connect to the exact same IP or URL as when 
deplying from VS. (Internet permission IS checked in manifest)
list.ItemClick += new EventHandler<ItemEventArgs>(List_ItemClick) is causing 
ANR (never seen this when deploying from VS either)


As for the TypeInitializationException I think I once found a post saying that 
older version of .NET had this issue. Which .NET version are Mono for Android 
"using" or compatible with?

Thanks, Nicklas

-----Original Message-----
From: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Jonathan Pryor
Sent: 14. oktober 2011 04:13
To: Discussions related to Mono for Android
Subject: Re: [mono-android] System.Net.Sockets exception

Warning: I'm not known for being the smartest guy in the room. That said...

On Oct 13, 2011, at 8:47 AM, Nicklas Møller Jepsen wrote:
> The main problem is that I'm seeing completely different behavior when 
> running the app from VS (on a device) compared to manually copying the APK to 
> the same the device and installing it. How can this be?

There are _lots_ of potential reasons for this. :-)

1. Release builds (which are deployable to the Android Market, and which you 
mentioned later) bundles the runtime and links all required assemblies in order 
to minimize application size. Debug builds don't do that (by default):

        http://docs.xamarin.com/android/advanced_topics/linking

This is the most plausible reason for your ClassNotFoundException -- you've 
performed a Release (linking) build, and the linker failed. Try rebuilding with 
linking disabled for whatever assembly contains the missing type, and please 
file a bug at bugzilla.xamarin.com (assuming that the "much smarter" linker in 
1.9.1 doesn't fix the issue).

2. For Debug builds (by default), Installing a .apk outside of the IDE won't 
result installing the required shared runtime packages, which will result in 
numerous errors when attempting to launch the application.

3. The shared runtime is not ABI stable. If you deploy the shared runtime to 
your device and then later upgrade your Mono for Android install, if the shared 
runtime isn't upgraded on your device all sorts of bizarre things will break.

I'm probably missing other scenarios, and the differences between Release and 
Debug builds will only increase over time (in order to speed up developer 
turnaround while debugging).

As far as the TypeInitializationException from System.Net.Sockets.Socket, 
unfortunately we're going to need a bug filed for that one, as we don't see any 
way for an exception to be emitted from the System.Net.Sockets.Socket static 
constructor:

        
https://github.com/mono/mono/blob/mono-2-10/mcs/class/System/System.Net.Sockets/Socket_2_1.cs#L770

If someone seeing this could file a bug with a reproducible test case, it would 
be much appreciated.

Thanks,
 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to