Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

int.Parse on negative number results in exception

$
0
0

This line of code:

int.Parse("-1");

Results in a FormatException that says "Input string was not in the correct format" when i run it on a device. On the emulator it works just fine. I've tested this with a bunch of devices, and the only one that is working as intended (i.e. returns an int with value -1) is the Samsung Galaxy Nexus, running android 4.2.1. All these devices generates an exception:

  • Google Nexus 7 (4.3)
  • Samsung S3 (4.1.2)
  • Samsung Galaxy Tab (4.0.4)
  • LG P970 (2.2.2)
  • HTC Sensation (2.3.4)

I also tried to download the app C#Shell from playstore on a device, and enter the line above, the result is the same:

Do anyone know why this happens, or what can be done to resolve this issue?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>