WinCE 6.0 Native Exception when String Array more than 10000 row loaded

Unanswered WinCE 6.0 Native Exception when String Array more than 10000 row loaded

  • Friday, April 27, 2012 9:31 AM
     
      Has Code

    Hi Guys;

    I am developing a software for Ingenico IPA280. It has Wince 6.0 on it and using CF 3.5 and Sql Compact database.

    Normally program runs smooth without an exception. When I added code below, it starts to fire native exception at "this.Close()" or "this.Hide()" kinds of methods (WinForm based methods). Entire code blocks are under try catch blocks. Non of them catches anything (Becasue it is native exception). With taskmanager i am seeing 46mb free memory, so there is no shortage of memory.

     I have 2 question:

    1- How can i find underlying problem?

    2- Why i get native exception and how to correct it?

    Exception Message Box:

    Application Error

    Application <Application Name> encountered a serious error and must shutdown.

    Code Block: (Randomly  generating 10000 strings and assining to a string[] or List<string> array. Then I am using for search)  Please do not suggest alternative search methods, i am currious about how to handle and solve the problem

    blackList = new List<string>(); // I tried string[] array too. Nothing changed
                    Random rndThsnd = new Random();
                    Random rndLast = new Random();
                    for (int j = 0; j < lenBlck; ++j)
                    {
                        string cardBase = "1111 2222 3333 44";
                        string thsnd = rndThsnd.Next(10, 99).ToString();
                        string lstPart = rndLast.Next(1001, 9999).ToString();
                        string whlBlackCard = cardBase + thsnd + " " + lstPart;
                        blackList.Add(whlBlackCard);
                    }

    Thanks.



    • Edited by SonizciTR Friday, April 27, 2012 9:32 AM
    • Edited by SonizciTR Friday, April 27, 2012 9:34 AM
    • Edited by SonizciTR Friday, April 27, 2012 10:19 AM
    • Moved by tonysoper_MSFT Wednesday, May 02, 2012 7:46 PM wrong forum (From:TechNet Wiki Discussion)
    •  

All Replies

  • Thursday, May 03, 2012 3:20 AM
    Moderator
     
     

    Hello,

    In the managed codes, we can use try-catch block to get the exception. We can use it when we try to connect or open the database.

    Also, some exception thrown by the native code. You can use GetLastError() function to catch them. But in the managed codes we need to p/Invoke this API, like this
    http://www.pinvoke.net/default.aspx/coredll.getlasterror

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

  • Thursday, May 03, 2012 9:31 AM
     
     

    Hi Jesse;

    I am using try/catch blocks everywhere but they are not catching the exception. At debug mode, i am going step by step (with F10) when i reacehed this.Hide(), this.Close() winform methods (These have try/catch block too.), debuging stops immediately. Program shutdowns too . Showing no exceptiond detail. Only message i get the error screen on the mobile device. Taht is:

    Mobile Device Error Form Text: Application Error

    Mobile Device Error Form Inside: Application <Application Name> encountered a serious error and must shutdown.

    try{

    this.Close() //Boom. Debug stops. If i put "GetLastError()" after here, i can not see anything

    }catch(Exception ex) //Does not step in here....

    {

    If i put "GetLastError()" here, it is not catching any exception. I have already got messagebox and logwriter functions here

    }

    So i have nothing about about exception (IO, OutOfIndex, Memory...). I have no clue. If I comment out 10000 rows load, everything works fine.

    Any suggestions?


    • Edited by SonizciTR Thursday, May 03, 2012 9:31 AM
    •