Very annoying Designer error message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am working on a solution which has a number of forms. At some point, mostly
during builds, I get an error message box displaying the following line of
text:

Array rank '2' is too high.

A search of the on-line doc reveals the following explanation:

"Visual Studio only supports single-dimension arrays in the code block that
is parsed by the designer. Multidimensional arrays are valid outside this
area."

The original error message box does not point to a code location where the
error occurred, presumably in a xxx.Designer.cs file. A text search in the
entire solution reveals nothing.

This is an apparently benign message in that execution proceeds as expected
but the behaviour is very annoying.

Anybody have any suggestions on how I might find the source of the problem?

To MS people, is there any reason why the message box can't be a little more
helpful.

Thanks in advance.

Bob Costello
 
Bob,

That means you have a control, usercontrol or a form used as a base class
for other form(s) that has public propoerty of type multidimensional array.
VS designer tries to generate code in InitializeComponent method for all
public properties that have value different than the default value. As the
error message sugests VS doesn't support this type of properties.
You cannot find the problem using search because this code hasn't been
generated. If you don't have any problems at run-time this means the
property shouldn't be serialzied in the first place. Find this property(ies)
and mark it out with
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
attribute. This will remove the error message.
 
Stoitcho,

This may be the problem. We do have multi-dimensional arrays and some of
them may be in base form classes. I am at home now and don't have the source
code. I will check it out tommorow at work. I think you are right.

Thanks and Best Regards,

Bob Costello
 
Back
Top