Re: [mono-android] System.Net.WebClient.UploadFileAsync Problem
It's not a feature request. It's a SEVERE BUG in the Mono WebClient implementation! -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/System-Net-WebClient-UploadFileAsync-Problem-tp5157961p5158060.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] System.Net.WebClient.UploadFileAsync Problem
Thank you very much. Maybe I should explain my situation: I bought a MonoTouch + MonoDroid enterprise licence almost a year ago, when it was still with Novell. We already have two applications developed in C# for .NET 2.0 for Windows Desktop and also for the .NET Compact Framework for those good old no longer built Windows Mobile devices. One of the applications is about 250K lines of code of which we share about 150K lines between .NET for Windows, .NET Compact Framework, MonoTouch and Mono for Android. Right now my colleague who is responsible for iPhone development is making good progress using MonoTouch and the port is almost complete. Which is great. With Mono for Android things look not at all that good and we have often been at the verge of giving it up completely. Due to the many (now fixed) GC bugs it was almost impossible to use the partly ported Android app for more than a short while without crashing. Also the Debugger was unusably slow, if it worked at all. These problems were probably due to the large (?) scale of the project including background threads, Internet access and so on. I really hope that Mono for Android will soon come to the point of sophistication where MonoTouch already is and which enables us to actually create a releaseable product. Thank you for making this possible! -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/System-Net-WebClient-UploadFileAsync-Problem-tp5157961p5158187.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] System.Net.WebClient.UploadFileAsync Problem
Got me :-) To my surprise your code does indeed add the MIME header stuff, even on the .NET Framework for Windows. So I went back to my real application code to check this out. I found the difference is that we are using "PUT" and not "POST" as the HTTP method. If you change your line to wc.UploadFileAsync (new Uri ("http://127.0.0.1:9000/";), "PUT", "uploadfile.cs", evt); then .NET for Windows does no longer add the MIME headers. Whereas, Mono still does. Cheers, Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/System-Net-WebClient-UploadFileAsync-Problem-tp5157961p5158294.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
[mono-android] Memory Leak with Background Image
Hi, it seems that bitmap images attached as background drawables are never released. In order to re-create the problem just create a default Mono for Android project and add the line android:background="@drawable/wallpaper" to the outer LinearLayout. Also add a wallpaper.png image (make it large to quickly see the problem, e.g. 1280x1024 pixels) to the resources drawable folder. Then start the application. When turning the orientation of the device (portrait/landscape) the activity is re-created with every turn. Turning the device several times (about 7 times with a 1280x1024 image) causes an exception because we are already running out of memory. To verify the problem I also created a Java Android default application and made the very same changes to it, using the very same image. Needless to say, the real Android application does never exhaust its memory. I assume that Mono for Android somewhere keeps a persistent internal reference to every Activity that is ever created and never releases it. Thus all resources attached to an Activity are never released, too. I even trimmed down the default application to just namespace MonoAndroidApplication2 { [Activity(Label = "MonoAndroidApplication2", MainLauncher = true)] public class Activity1 : Activity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); } } } and still, the memory of the background image and probably more is leaked. BTW: Sure I could use a smaller image or maybe no background image at all. But this would only defer the problem and not solve it. Cheers, Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Memory-Leak-with-Background-Image-tp5165833p5165833.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Layout - Activity with ListView and TextView below it
A more optimized layout serving the same purpose would be: http://schemas.android.com/apk/res/android"; android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > Less nesting means faster layout. Also I would prefer to use the Android predefined ID for the ListView. Cheers, Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Layout-Activity-with-ListView-and-TextView-below-it-tp5149952p5166455.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] upper limit on resources/drawable size?
Hi, I do not know whether there is an upper limit to the file size, but you have to keep in mind that a JPEG file with a pixel size of 1000x1000 that is maybe only a 50 KB file, will require 3 MB (1000x1000x3) when loaded. Therefore I am more concerned with the resulting pixel size of images, then with the compressed image file size. Just my thoughts. Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/upper-limit-on-resources-drawable-size-tp5429392p5429700.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Memory Leak with Background Image
Thanks, that did solve the problem. I also added another GC.Collect() in my OnRestart() override, just to be absolutely sure. Cheers, Andreas. -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Memory-Leak-with-Background-Image-tp5165833p5430759.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] sharing code between mono touch and mono for android
Hi, we are sharing code across Windows .NET, Mono for Android and MonoTouch. Earlier we even also shared with .NET Compact Framework for Windows Mobile. We are sharing the source code using the Share feature of Visual SourceSafe which is very very useful for this kind of setup. If a code change is checked in on a shared source file it is automatically spread across all projects that share this file. No need to maintain multiple copies. The only drawback is that we have to be cautious not to make breaking changes to shared code. Well, another drawback is that we have to use Visual SourceSafe because there is no other source management tool with a similar feature. We are using predefined symbols like MONO, ANDROID, IPHONE, WIN32 and so on for the parts of the code which have to be platform dependent, or which require a .NET compatibility work around. All this works great for us. Cheers, Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/sharing-code-between-mono-touch-and-mono-for-android-tp5441681p5441955.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
[mono-android] Understanding ArrayAdapter and Java.Lang.Object
Hi all, I am trying to understand what exactly happens when I am using an Android.Widget.ArrayAdapter for my list views and spinners. Considering the following sample code from an Activity: string[] vs = new string[] { "one", "two", "three" } ArrayAdapter aa = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, vs); Spinner s = (Spinner)this.FindViewById(Resource.Id.myspinner); s.Adapter = aa; I know that on the Java side, the ArrayAdapter needs a Java list with Java objects. How is Mono for Android converting my C# string to the Java objects that Java needs? Later in my code when I use Java.Lang.Object o = s.SelectedItem; How does the returned Java object relate to my original string? And how do I get back to the original string? Finally: Is there a better (faster, less memory using) way than using an ArrayAdapter at all? Any insights appreciated. Cheers, Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Understanding-ArrayAdapter-string-and-Java-Lang-Object-tp5711252.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Understanding ArrayAdapter and Java.Lang.Object
Thanks for your elaborate answer. My code to get the selected item now looks like this: Java.Lang.Object o = spinner.SelectedItem; string s = o.ToString(); o.Dispose(); Think this is the best was to do. For more complex list items I am already deriving from BaseAdapter. I will continue to use the ArrayAdapter only for simple types. Cheers, Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Understanding-ArrayAdapter-string-and-Java-Lang-Object-tp5711252p5711275.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Listview
Jonathan Pryor-2 wrote > >> However, in my experience the Google docs are terrible. > Fully agree. Just try to understand the many Adapter classes based on documentation that does nothing but rephrase the method signatures. In the end it is just "trial and error" or "looking at the source". -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Listview-tp5711222p5711298.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] (aresgen) Finding Layout xml errors
Hi, this exception happens whenever a referenced resource id could not be resolved. In particular it happens whenever using upper case characters in color names, or many other resource ids. To avoid this problem it is best to only use lower case characters for any and all resource file names and ids. -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/aresgen-Finding-Layout-xml-errors-tp4391528p4393297.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Miguel's Announcement...
I was hoping for something more, too. As the current Android for Mono release is not at all stable enough for a real product our company abandoned all Android (MonoDroid) development for now. This is a pity, as we did invest a lot of work and also bought a license that is actually worthless by now. Somewhere I am still hoping for a wonder of some kind. But I am afraid, that it won't happen. Doing some HTML5/JavaScript/PhoneGap now. Hopefully this will be the solution for our cross plattform development efforts. -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Miguel-s-Announcement-tp4425485p4425762.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
[mono-android] HTTPS Communication fails after update to 4.0
Hi, my application was working flawlessly with the last official Android for Mono release. After upgrading to 4.0, however, my online communication code fails with the following internal error: 12-06 15:20:52.185: I/mono-stderr(16976): ERROR building certificate chain: System.NullReferenceException: Object reference not set to an instance of an object 12-06 15:20:52.195: I/mono-stderr(16976): at Mono.Security.Cryptography.PKCS1.Encode_v15 (System.Security.Cryptography.HashAlgorithm hash, System.Byte[] hashValue, Int32 emLength) [0x0] in /home/jon/Development/xamarin/mono/mcs/class/corlib/Mono.Security.Cryptography/PKCS1.cs:336 12-06 15:20:52.195: I/mono-stderr(16976): at Mono.Security.Cryptography.PKCS1.Verify_v15 (System.Security.Cryptography.RSA rsa, System.Security.Cryptography.HashAlgorithm hash, System.Byte[] hashValue, System.Byte[] signature, Boolean tryNonStandardEncoding) [0x00020] in /home/jon/Development/xamarin/mono/mcs/class/corlib/Mono.Security.Cryptography/PKCS1.cs:308 12-06 15:20:52.195: I/mono-stderr(16976): at Mono.Security.Cryptography.PKCS1.Verify_v15 (System.Security.Cryptography.RSA rsa, System.Security.Cryptography.HashAlgorithm hash, System.Byte[] hashValue, System.Byte[] signature) [0x0] in /home/jon/Development/xamarin/mono/mcs/class/corlib/Mono.Security.Cryptography/PKCS1.cs:298 12-06 15:20:52.195: I/mono-stderr(16976): at System.Security.Cryptography.RSAPKCS1SignatureDeformatter.VerifySignature (System.Byte[] rgbHash, System.Byte[] rgbSignature) [0x00058] in /home/jon/Development/xamarin/mono/mcs/class/corlib/System.Security.Cryptography/RSAPKCS1SignatureDeformatter.cs:80 12-06 15:20:52.195: I/mono-stderr(16976): at Mono.Security.X509.X509Certificate.VerifySignature (System.Security.Cryptography.RSA rsa) [0x000ca] in /home/jon/Development/xamarin/mono/mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs:513 12-06 15:20:52.195: I/mono-stderr(16976): at Mono.Security.X509.X509Certificate.VerifySignature (System.Security.Cryptography.AsymmetricAlgorithm aa) [0x0001c] in /home/jon/Development/xamarin/mono/mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs:522 12-06 15:20:52.195: I/mono-stderr(16976): at System.Security.Cryptography.X509Certificates.X509Chain.IsSignedWith (System.Security.Cryptography.X509Certificates.X509Certificate2 signed, System.Security.Cryptography.AsymmetricAlgorithm pubkey) [0xf] in /home/jon/Development/xamarin/mono/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs:702 12-06 15:20:52.195: I/mono-stderr(16976): at System.Security.Cryptography.X509Certificates.X509Chain.Process (Int32 n) [0x00085] in /home/jon/Development/xamarin/mono/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs:530 12-06 15:20:52.195: I/mono-stderr(16976): at System.Security.Cryptography.X509Certificates.X509Chain.ValidateChain (X509ChainStatusFlags flag) [0x0002c] in /home/jon/Development/xamarin/mono/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs:466 12-06 15:20:52.195: I/mono-stderr(16976): at System.Security.Cryptography.X509Certificates.X509Chain.Build (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) [0x0001f] in /home/jon/Development/xamarin/mono/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs:115 12-06 15:20:52.195: I/mono-stderr(16976): at System.Net.ServicePointManager+ChainValidationHelper.ValidateChain (Mono.Security.X509.X509CertificateCollection certs) [0x000a3] in /home/jon/Development/xamarin/mono/mcs/class/System/System.Net/ServicePointManager.cs:475 12-06 15:20:52.195: I/mono-stderr(16976): Please, report this problem to the Mono team Is this a bug in the new Mono for Android, or am I doing something wrong? Best regards, Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/HTTPS-Communication-fails-after-update-to-4-0-tp5052218p5052218.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] HTTPS Communication fails after update to 4.0
Hi, I am testing with an LG Optimus One and an LG Optimus 2X (both with Gingerbread). The error occurs, for example, when accessing the PayPal NVP API at "https://api-3t.paypal.com/nvp";. I am using HttpWebRequest via WebRequest.Create(sUrl). Thank's for your support. -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/HTTPS-Communication-fails-after-update-to-4-0-tp5052218p5074165.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] VS2010 crash on F5
Hi, where do I find the "release notes"? I can't find them anywhere in the documentation linked from xamarin.com. Also, how can I check which version of Mono for Android is currently integrated in VisualStudio? Can't find any "about" dialog or something. Finally: I just downloaded the free preview, but it seems that it only supports MonoDevelop now, and VisualStudio is no longer supported. Is this true? -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/VS2010-crash-on-F5-tp5135114p5140214.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
[mono-android] Unexpected Exception from System.Net.WebClient result
Hi, I am currently porting some (actually a lot of) code from .NET to Mono for Android. At one point there seems to be a problem with the WebClient class, in particular when the connected server responds with an error. The following code snippet can easily provoke (and also explains) the problem: System.Net.WebClient aWebClient = new System.Net.WebClient(); aWebClient.DownloadStringCompleted += (sender, args) => { // This logging output appears as expected Android.Util.Log.Info("TADA", "DownloadStringCompleted"); // This also appears as expected. the property Error is non-null due to the error if (args.Error != null) { Android.Util.Log.Error("TADA", "Error"); } // At the following line an exception is thrown just because the Result property was accessed: // System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. // Instead the Result property should be null. if (args.Result != null) { Android.Util.Log.Info("TADA", args.Result); } }; aWebClient.DownloadStringAsync(new Uri(@"https://justtogetanerror.com/doesnotexist";)); I am testing/debugging on a LG Optimus 2X and downloaded the latest Mono for Android yesterday. Thanks for your attention Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Unexpected-Exception-from-System-Net-WebClient-result-tp5142099p5142099.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Unexpected Exception from System.Net.WebClient result
Hi, during further porting I found, that a request sent through the WebClient sometimes succeeds and sometimes fails. I am not sure whether this is a device related problem. However, the same code always succeeds on my desktop PC connect to the same W-LAN. In order to reproduce you just have to create a new default Android application and replace the button click event as follows: button.Click += delegate { Android.Util.Log.Info("TADA", "Click"); System.Net.WebClient aWebClient = new System.Net.WebClient(); aWebClient.DownloadStringCompleted += (sender, args) => { Android.Util.Log.Info("TADA", "DownloadStringCompleted"); if (args.Error != null) { Android.Util.Log.Error("TADA", "Error"); } }; aWebClient.DownloadStringAsync(new Uri(@"http://subsembly.com/";)); }; Again, I am testing/debugging on a LG Optimus 2X and downloaded the latest Mono for Android yesterday. Thanks for any help. -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Unexpected-Exception-from-System-Net-WebClient-result-tp5142099p5142150.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Unexpected Exception from System.Net.WebClient result
Hi, yet again :-) I just tested my second example code on an LG Optimus One, and it works every time I click the button. Again on the same W-LAN. So it seems that the Problem is related to the LG Optimus 2X. BTW: The Optimus One runs Android 2.3.3, the Optimus 2X runs Android 2.3.4. Could the problem be related to the Dual-Core processor of the Optimus 2X? -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Unexpected-Exception-from-System-Net-WebClient-result-tp5142099p5142167.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Unexpected Exception from System.Net.WebClient result
So far I have only be running Debug builds with shared runtime on Android 2.3.3 or Android 2.3.4 only. According to the Visual Studio Help/About I am using Mono for Android 4.0.1. I have to admit, that I don't have a clue whether I should check "armeabi" or "armeabi-v7a" or both on the Application settings tab. Currently I only have "armeabi" checked. I intend to target all Android Smartphones starting with Android 2.1. So which combination of "armeabi" and/or "armeabi-v7a" would you recommend? -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Unexpected-Exception-from-System-Net-WebClient-result-tp5142099p5142994.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Unexpected Exception from System.Net.WebClient result
Hi, this is the output: >adb shell getprop ro.product.cpu.abi armeabi-v7a >adb shell getprop ro.product.cpu.abi2 armeabi So, to be on the save side, I now have both checks, armeabi and armeabi-v7a, ticked in my Application settings. I am still investigating the orginal WebClient problems and found one more compatibility problem with the WebClient class on Android: The Event "DownloadStringCompleted" and probably other WebClient events, too, are not fired on the UI thread but on some background worker thread. However, in classic Windows Forms these events are fired on the UI thread. As the WebClient class is derived from System.ComponentModel.Component and is visible in the Windows Forms Designer, I would expect that the events are fired as UI events on the UI thread. To improve compatibility with existing code it would probably be better to fire these events on the UI thread in Mono for Android, too. Cheers, Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Unexpected-Exception-from-System-Net-WebClient-result-tp5142099p5148240.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Unexpected Exception from System.Net.WebClient result
Thanks a lot. After installing the 4.0.3 beta update and checking both armabi target platforms all other problems did disappear. So the wrong thread for the WebClient events is the last thing that remains. Cheers, Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Unexpected-Exception-from-System-Net-WebClient-result-tp5142099p5151190.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid