INFO: Visual J# .NET Does Not Support Multidimensional SafeArrays (818448)



The information in this article applies to:

  • Microsoft Visual J# .NET (2003)
  • Microsoft Visual J# .NET (2002)
  • Microsoft Common Language Runtime (included with the .NET Framework 1.1)
  • Microsoft Common Language Runtime (included with the .NET Framework) 1.0

SUMMARY

When you use multidimensional SafeArray data types in Microsoft Visual J# .NET, you may receive unexpected results.

Visual J# .NET does not support multidimensional SafeArrays and may only support one dimensional SafeArray data types. If the SafeArray is multidimensional, the marshaling may fail.

MORE INFORMATION

In Component Object Model (COM), an array is represented as a SafeArray data type. A SafeArray is a self-describing array that contains any type that can be placed in a VARIANT. SafeArray can have any number of dimensions. Each of these dimensions can have distinct upper and lower bounds. SafeArray is similar to the Microsoft Visual Basic 6.0 array type.

By default, the behavior of the importer differs when it encounters SafeArray data types. This behavior depends on whether you use the Type Library Importer (Tlbimp.exe) or Microsoft Visual Studio .NET. When it refers a type library in Visual Studio .NET, the IDE runs the equivalent of Tlbimp.exe with the /sysarray option. Every occurrence of a SafeArray is converted to a System.Array type. System.Array is the base class for all arrays in Microsoft .NET Framework arrays and is suffiently flexible to represent anything that a SafeArray can represent. This includes multiple dimensions and custom bounds for each dimension.

In Visual J# .NET, multidimensional SafeArrays do not work even if you run Tlbimp.exe with the /sysarray option.

Modification Type:MajorLast Reviewed:8/5/2003
Keywords:kbJava kbide kbCompiler kbCOMInterop kbinfo KB818448 kbAudDeveloper