Bug 4760 - "Invalid cast." displayed for uint value
Summary: "Invalid cast." displayed for uint value
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2012-04-30 11:41 UTC by Marek Safar
Modified: 2012-05-01 15:43 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Marek Safar 2012-04-30 11:41:04 UTC
using System;

namespace temp44
	class MainClass
		public static void Main (string[] args)
			int a = -775616373;
			uint ui = (uint)a;
			return; // BREAK here and add "(uint)a" to Watch window

"Invalid cast." value is displayed
Comment 1 Jeffrey Stedfast 2012-04-30 12:37:19 UTC
We seem to be using System.Convert.ChangeType() which is throwing OverflowException.
Comment 2 Jeffrey Stedfast 2012-04-30 17:11:24 UTC
fixed in git master
Comment 3 Marek Safar 2012-04-30 18:18:43 UTC
I can still get it for different types.



Do I have to fill a bug report for every type ?
Comment 4 Jeffrey Stedfast 2012-04-30 23:05:12 UTC
I fixed it for everything I could think of but missed decimal.

What else isn't working for you?
Comment 5 Marek Safar 2012-05-01 04:15:42 UTC
Most of C# valid casts are not working

Few examples

(int)o // where int? o = 3;

+ any user defined, probably all lifted nullable and all type parameter conversion

and some invalid one are working

Comment 6 Jeffrey Stedfast 2012-05-01 14:10:52 UTC
I've fixed a bunch more cases now, but still haven't figured out how to make (decimal) work.
Comment 7 Jeffrey Stedfast 2012-05-01 15:43:59 UTC
ok, fixed decimal casts too now