Error : Exception System.ArgumentOutOfRangeException - CLR_E_OUT_OF_RANGE

Hi guys,
I wrote in GHI forum some days ago regarding an error that highlights in Output Window of the VS2008 professional edition during the debug phase.The error is this:

    #### Exception System.ArgumentOutOfRangeException - CLR_E_OUT_OF_RANGE (6) ####
    #### System.Collections.ArrayList::get_Item [IP: 0000] ####
 Uncaught exception 

That’s the partial code of my application (i’m trying to write some data to flash memory):

public ScreenData screenData;

private static ExtendedWeakReference EWR_data;

private class USelector { };

public class ScreenData
  public ArrayList Menus;
  public ArrayList ScreenPages;

  public ScreenData()
     Menus = new ArrayList();
     ScreenPages = new ArrayList();
    catch (Exception exc)
    Debug.Print("EXC_SCREENDATA: " + exc.Message + "\n" + exc.StackTrace);


public static void Initialize_Function()



//Try to recover data or create a new EWR
EWR_data = ExtendedWeakReference.RecoverOrCreate(typeof(USelector ),                                 
                                                                          ExtendedWeakReference.c_SurviveBoot |          

EWR_data.Priority = (int)ExtendedWeakReference.PriorityLevel.Important;

//Now, if the persistent data is found into our EWR, get it!
screenData = (ScreenData)EWR_data.Target;

//If the EWR is not found in memory the Target property returns NULL value
if (screenData == null)
Debug.Print("EWR not found");
screenData = new ScreenData();

//Fill my ArrayList screenData with some infos

EWR_data.Target = screenData;

Debug.Print("EWR found!!!");

The error is displayed when i instantiate the screenData variable, and then every time I use it the error is displayed again. However i verified the problem is not due to the EWRs R/W access.
Furthermore the strange think I discovered is that it arises only in the VS2008 PRO edition, while trying the same program in VS2008 Express Edition it doesn’t appear. I have both editions installed in the same OS on the same computer. Could this be a problem?
Someone had the same problem, or knows how to solve this problem???

Thanks in advance

How is this possible? The code runs inside the device so how would it matter?

Unless you are using the emulator?

[quote]Furthermore the strange think I discovered is that it arises only in the VS2008 PRO edition, while trying the same program in VS2008 Express Edition it doesn’t appear. I have both editions installed in the same OS on the same computer. Could this be a problem?

Probably, yes!

Why not using Visual Studio 2010 Express?
Look at the

is anyone going to ask what version of the SDK is being used?


I’m about to, but you’re already did. Just beat me by the second! :smiley:

Thanks for the answers and sorry for the late reply! Ok, i’m using the 4.0 version of the MF on a Embedded Master processor (but also with my EMX development board v4.0 happens). I’m not using the VS2010 because it needs v4.1 and I’ve not installed it yet. Should this solve this strange issue?
When I debug my application. i not use the emulator but i use real device connected to PC!
Could be some strange conflict because I have different versions of Visual Studio installed on my PC (Express and Professional 2008) ??

Thanks a lot

Your issue is almost certainly because of a mismatch between the three key components that MUST match - the Microsoft NETMF SDK, the GHI SDK, and the Firmware version on the device. You have a more complex setup since you have at least two devices, and it seems like at least two PCs set up with the components you need. You have to get them all back in sync.

The easiest way to do that is to move to the latest GHI SDK, which requires you to move to Visual Studio 2010 and the NetMF 4.1 SDK from Microsoft first. You then need to apply the firmware update across all your devices.

I suppose you could try to troubleshoot this more, but do you gain anything. Sure, you could TRY to install the same (older) software on both PCs and then apply the GHI firmware from the SDK and see if that makes a difference. If you needed to obtain the old software though you might be in trouble, not sure if any of that is still available.

Doing this wouldn’t give you all the good benefits that the 4.1 and subsequent GHI updates has bought either.

GHI’s stance on the consumer range of fezzes is to only support the latest GHI SDK, but I don’t know if there is any exception to that for your boards; but it certainly won’t be easy to get ongoing advice/assistance since nobody else (perhaps not even GHI !) will have that configuraiton, so my suggestion is move forward, you have nothing to lose and lots to gain.

Developers shoul lock thier production to a specific version. Note how I said production not development. We do not support development on any but the latest SDK

OK. I will follow your advice. I will install the VS2010 and then i will check if it works (if you suggest me to do this I suppose that the MF v4.1 is stable on VS2010).

Thanks again.

netmf 4.1 is awesome.
VS2010 is awesome.
GHI SDK is awesome.

Fez and GHI are even more awesome.

Lol thanks Brett

Hey guys, i found the problem for this issue. Do you want to know it?
Ok…it’s really stupid…but i take a lot to find it… ready?

The error was due to the fact that the

    public class ALClass
        public ArrayList AL1;
        public ArrayList AL2;

        public ALClass()
            AL1 = new ArrayList();
            AL2 = new ArrayList();

was defined into another class

    public class ContainerClass

So… to solve the problem it just need to put it out of the class… and the message is not showed anymore.
Very very stupid thing, but it was hard to find!
Just in case someone has the same problem, this could be a good hint!

I just don’t know why it happens (maybe someone can give me an answer), but this solved the problem!

Really thanks for the help!