Main Site Documentation

Error : Exception System.ArgumentOutOfRangeException - CLR_E_OUT_OF_RANGE


#1

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 { };

[Serializable]
public class ScreenData
{
  public ArrayList Menus;
  public ArrayList ScreenPages;

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

}




public static void Initialize_Function()
{

  try
 {

  RESET_EWR:

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

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
FillArrayList();

EWR_data.Target = screenData;
System.Threading.Thread.Sleep(2000);

}
else
{
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
Paolo


#2

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

Unless you are using the emulator?


#3

[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?
[/quote]

Probably, yes!

Why not using Visual Studio 2010 Express?
Look at the www.tinyclr.com/


#4

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


#5

Mike:

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


#6

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
Paolo


#7

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.


#8

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


#9

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.
Paolo


#10

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

Fez and GHI are even more awesome.


#11

Lol thanks Brett


#12

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


    [Serializable]
    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!
Paolo