Share via


Troubleshooting Exceptions: System.Runtime.InteropServices.SafeArrayRankMismatchException

A SafeArrayRankMismatchException exception is thrown when the rank of an incoming SAFEARRAY does not match the rank specified in the managed signature.

Associated Tips

  • Make sure your array has the required number of dimensions.
    Because the rank and bounds of a safe array cannot be determined from the type library, the rank is assumed to equal 1, and the lower bound is assumed to equal 0. The rank and bounds must be defined in the managed signature produced by the Type Library Importer (Tlbimp.exe).

See Also

Tasks

How to: Use the Exception Assistant

Concepts

Default Marshaling for Arrays

Overview of Arrays in Visual Basic

Reference

SafeArrayRankMismatchException

SafeArray