Watch, Follow, &
Connect with Us

Please visit our new home

Public Report
Report From: Delphi Prism/Compiler    [ Add a report in this area ]  
Report #:  98598   Status: Open
Can't use certain array types between assemblies
Project:  Embarcadero Prism Build #:
Version:    2010.1 Submitted By:   Robert Ogren
Report Type:  Basic functionality failure Date Reported:  9/6/2011 4:36:55 AM
Severity:    Infrequently encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All versions Internal Tracking #:   287484
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
The compiler seems to generate incorrect code when using certain array types between assemblies.
Code similar to the following, which worked fine with the Spring 2011 release, produces a runtime error when compiled with XE2 (Oxygene version

Put the following in a class library:

  TableLayoutMatrix = array[0.., 0..] of string;

  TableLayout = public class    
    property Table: TableLayoutMatrix;

Put the following in the main method of an empty console application and add a reference to the class library.

class method ConsoleApp.Main(args: array of String);
  tl: TableLayout;
  tl := new TableLayout;

  if Assigned(tl.Table) then
    Console.WriteLine('Table property is assigned')
    Console.WriteLine('Table property is not assigned');

The code compiles without problem, but at runtime, the program fails with a MissingMethodException
Method not found: 'System.String[,] ModoptLib1.TableLayout.get_Table()'.

According to Reflector the call to get the property seems to have an extra modopt that causes the method to not be found.

callvirt instance string[,] modopt(<PublicImplementationDetails>/array$2$0,0$$) modopt([ModoptLib1]<PublicImplementationDetails>/array$2$0,0$$) [ModoptLib1]ModoptLib1.TableLayout::get_Table()

Types such as plain array of string and array[5..] of string seems to work OK.

Steps to Reproduce:
Compile and run the attached solution with a class library and a console application. You should get an error at runtime even though the program compiles OK.
Use simpler array types such as array of array of string to create a multidimensional array


Server Response from: ETNACODE01