I have a weird error.
error MMP0000: CLR_E_FAIL on this code:
Dim aColors(,) As Boolean = {{False, True, True}, {True, False, True}}
This is normal Visual Basic syntax.
  | ||||||||||||||
error MMP0000: CLR_E_FAIL
Started by JoopC, Jun 17 2013 11:15 AM
11 replies to this topic
#1Posted 17 June 2013 - 11:15 AM I have a weird error. error MMP0000: CLR_E_FAIL on this code:
Dim aColors(,) As Boolean = {{False, True, True}, {True, False, True}}
This is normal Visual Basic syntax.
#2Posted 17 June 2013 - 05:26 PM I'm assuming that is a compile-time (not runtime) error? When I get those at compile-time it is because the build step with the 'meta data processor' goes awry, and that can happen for many reasons -- for me usually too many static initializers, but other things cause it as well. OK, so I'm not hip to VB.net, but in C# on .NetMF we cannot have multi-dimensional arrays. We can have 'jagged' arrays. The language supports multidimensional arrays, of course, but the runtime does not. As a quicky, see if you can convert your array to a 'jagged' array, and if that makes things all better. #3Posted 17 June 2013 - 06:04 PM
Of curiosity, a "jagged" array would be one like this in C# right?
bool[][] bColors = new bool[]{ new bool[]{ false, true, true}, new bool[]{ true, false, true}};
#4Posted 17 June 2013 - 06:44 PM
almost; rhs needs the [][]: bool[][] bColors = new [color=#ff0000;]bool[][][/color]{ new bool[]{ false, true, true}, new bool[]{ true, false, true}};
but you get it. actually I have to look up the syntax every time I do it. Now since I had to reach for my dev studio, I went ahead and did try the multidimensional equivalent (in C#): bool[,] bColors = new bool[,] { { false, true, true }, { true, false, true } };
and I do get a metatdataprocessor error error MMP0000 so it will be interesting to hear from the OP if this helps in his case with the VB.
and again, that particular error seems to be generic -- I get it all the time from a variety of things. #5Posted 17 June 2013 - 07:26 PM
Ah, yes that was a typo, I meant to write "[][]", sorry for messing it up. I use that construct quite a lot, just didn't know it is called a "jagged" array.
#6Posted 20 June 2013 - 01:53 PM I did forgot the NEW :
Dim aColors As Boolean(,) = New Boolean(,) {{False, True, True}, {True, False, True}, {True, True, False}, {False, False, True}, {False, True, False}, {True, False, False}}
Link: http://msdn.microsof...y/2yd9wwz4.aspx
I'm getting old #7Posted 20 June 2013 - 03:55 PM
So am I apparently :-)
EDIT: Exchanged "are we" for "am I".
#8Posted 21 June 2013 - 12:50 AM hmm. are you sure that will work on netmf? you are right about the syntax itself for VB. but making a netmf vb quicky just now: Module Module1 Sub Main() REM write your code here REM this will not compile: Dim aColors As Boolean(,) = New Boolean(,) { {False, True, True}, {True, False, True}, {True, True, False}, {False, False, True}, {False, True, False}, {True, False, False} } REM but this will: Dim aColors()() As Boolean = { New Boolean() {False, True, True}, New Boolean() {True, False, True}, New Boolean() {True, True, False}, New Boolean() {False, False, True}, New Boolean() {False, True, False}, New Boolean() {True, False, False} } End SubEnd Module with the first part in, it fails, but with the second it's ok. I don't consider myself a VB programmer, but the multidimensional array limitation is a fundamental one to the netmf CLR, I believe, so it shouldn't have to do with language differences. #9Posted 21 June 2013 - 08:28 PM Yes, on this case you are right and I am wrong. I thought that I had changed my program code but i had not.
There are some differences that are annoying for me like SyncLock is not available in VB and bitshifting give's an weird error.
For SyncLock I use a workaround:
Static syncBool As Boolean While syncBool Thread.Sleep(5) End While
Try syncBool = True 'code here Catch ex As Exception End Try syncBool = False #10Posted 22 June 2013 - 11:26 PM Hmm, it's odd that SyncLock would be giving you an error. SyncLock should just be using a Monitor behind the scenes.
If you use Monitor.Enter() at the top of your section and Monitor.End() at the end (preferably wrapped in a Try...Finally block), does that work? Can you file a bug report on that at netmf.codeplex.com with a short repro? I'll be happy to ping someone on the VB team as well. Chris #11Posted 23 June 2013 - 09:45 AM That work around is bound to give you headaches since its not mutually exclusive between different threads. About SyncLock its important that the variable being "synclocked" is of reference type and that it has a value other than Nothing. I usually do something like this in a class implementation: Private _sync as new Object() . . . SyncLock _sync ' do stuff that require exclusive access End SyncLock Forgive me for any syntax errors, I always code C#. Does that not work for you? #12Posted 26 June 2013 - 01:30 PM I did report this bug.
Edit: speak about the devil, last sunday i got a update for Visual Studio. Test the syncLock and it's working, now i can cont with my code. Test bit shifting too, but that was not fixed. 2 user(s) are reading this topic0 members, 2 guests, 0 anonymous users | ||||||||||||||
|
||||||||||||||
This webpage is licensed under a Creative Commons Attribution-ShareAlike License. | ||||||||||||||