BUG: Non-vector array mess-up

C

Cholent

Did anyone notice a major bug in vb.net. The clr has two types of 'arrays':
vectors (1 dimensional, 0 based) and other arrays (any base, any dimensions).
In vb.net, you can only declare vectors, not 1-dimensional arrays. But when
you import an assembly, it recognizes all 1-dimensional arrays as vectors,
gets very confused, and creates unverifiable code that has major bugs in it
because it stores 1-dim arrays in vector variables.
 
T

Tom Shelton

Did anyone notice a major bug in vb.net. The clr has two types of 'arrays':
vectors (1 dimensional, 0 based) and other arrays (any base, any dimensions).
In vb.net, you can only declare vectors, not 1-dimensional arrays. But when
you import an assembly, it recognizes all 1-dimensional arrays as vectors,
gets very confused, and creates unverifiable code that has major bugs in it
because it stores 1-dim arrays in vector variables.

This is probably why you can't create a 1-dimensional non-zero based
array in VB.NET. I think it has always been there - in fact, I believe
you can't use 1-dimensional non-zero based arrays from C# either...
 
C

Cholent

I've just wrote the following il code:

int32[...] ArrayCast(class System.Array obj)
{ldarg.0
castclass int32[...]
ret}
If I pass it a 2-dim. array it fails with 'invalidcastexception' but if I
pass it a 1-dim, non-0-based array it works! So it seems to be a problem with
the clr as well.
 
C

Cholent

Cholent said:
I've just wrote the following il code:

int32[...] ArrayCast(class System.Array obj)
{ldarg.0
castclass int32[...]
ret}
If I pass it a 2-dim. array it fails with 'invalidcastexception' but if I
pass it a 1-dim, non-0-based array
Sorry, typo! I meant a vector (1-dim, 0-based0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top