Netduino home hardware projects downloads community

Jump to content


Photo

NetMf bug? Assigning an array type (typeof(x[])) to an array entry


  • Please log in to reply
No replies to this topic

#1 mlsomers

mlsomers

    Member

  • Members
  • PipPip
  • 10 posts

Posted 10 January 2016 - 01:49 AM

I'm using a NetDuino Plus, but this also happens in the emulator:

 

If I do this:

Type myType = typeof(object[]);

it works fine, so I can instantiate a typeof(object[]).

 

Also assigning a non array type to an array is working:

Type[] myTypes = new Type[] { typeof(object) };

No problem here, but... assign the first example to that array, or:

Type[] myArrayTypes = new Type[] { typeof(object[]) };

and I get:

 

#### Exception System.Exception - CLR_E_WRONG_TYPE (1) ####
#### Message:

#### ...

 

Also doing it indirectly gives the same result:

Type myType = typeof(object[]);
Type[] myArrayTypes = new Type[] { myType }; // boem!

I'll find a way to work around this somehow, maybe using the type name instead, but I'm sure this must be a bug in netmf? Or am I missing something?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.