BUG: Non-vector array mess-up

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Q2hvbGVudA==?=

    BUG: Non-vector array mess-up

    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.
  • Tom Shelton

    #2
    Re: BUG: Non-vector array mess-up

    On 2008-04-18, Cholent <Cholent@discus sions.microsoft .comwrote:
    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...

    --
    Tom Shelton

    Comment

    • =?Utf-8?B?Q2hvbGVudA==?=

      #3
      Re: BUG: Non-vector array mess-up

      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 'invalidcastexc eption' 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.

      Comment

      • =?Utf-8?B?Q2hvbGVudA==?=

        #4
        Re: BUG: Non-vector array mess-up

        "Cholent" wrote:
        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 'invalidcastexc eption' but if I
        pass it a 1-dim, non-0-based array
        Sorry, typo! I meant a vector (1-dim, 0-based0
        it works! So it seems to be a problem with
        the clr as well.

        Comment

        Working...