Bug 17604 - Initialisation of multi-dimensional array throws on bound range
Summary: Initialisation of multi-dimensional array throws on bound range
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Rodrigo Kumpera
URL:
Depends on:
Blocks:
 
Reported: 2014-02-05 03:59 UTC by Marek Safar
Modified: 2016-04-14 05:53 UTC (History)
1 user (show)

Tags:
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 GitHub or Developer Community 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:
Status:
RESOLVED FIXED

Description Marek Safar 2014-02-05 03:59:18 UTC
using System;
using System.Linq;

class X
{
	public static void Main ()
	{
		var type1 = Type.GetType ("System.Char[,]");

		var ctor = type1.GetConstructors ().Where (l => l.GetParameters ().Count () == 4).Single ();
		var o = ctor.Invoke (new object[] {
			1, 5, -232, 340
		});

		Console.WriteLine (((char[,]) o).GetUpperBound (1)); // 107

		return;
	}
}

.NET : 107
Mono

ystem.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.OverflowException: Number overflow.
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
  at X.Main () [0x00000] in <filename unknown>:0
Comment 1 Rodrigo Kumpera 2016-04-14 05:53:34 UTC
Works with 4.4