Strange exceptions in .Net CF framework format for WinCE 6.0 R3

In our .Net CF application, we get strange errors from parts of the code that shouldn't have problems. For example, the following code:

public void AddParm(string str)
{
    string[]        pair = str.Split('=');
    string          key = pair[0].Trim();
    string          value = pair.Length > 1 ? pair[1] : "";
    if (key.Length > 0)
    {
        if (_parmTable.ContainsKey(key))
            _parmTable[key] = value;
        else
            _parmTable.Add(key, value);
    }
}

The procedure that calls AddParm () completes the call in the Try ... Catch block, catching all types of exceptions.

public void Unpack(string txn)
{
    try
    {
        // split out strings like: "EVENTLABEL:x=1,y=2,z=3"
        char chEvent = ':';
        char chSeparator = ',';

        _parmTable = new Hashtable();

        int iEvent = txn.IndexOf(chEvent);

        if (iEvent == -1)
            _eventLabel = txn;
        else
        {
            _eventLabel = txn.Substring(0, iEvent);

            string parms = txn.Substring(iEvent + 1).TrimEnd('\n');
            string[] items = parms.Split(chSeparator);

            if (items.Length <= 0)
                AddParm(parms);
            else
                foreach (string item in items)
                    AddParm(item);
        }
    }
    catch (Exception ex)
    {
        AppLog.logException(string.Format("UnpackedTask.Unpack: Error parsing '{0}'", txn), ex);
    }
}

I just got an unhandled exception by specifying the failure module as mscoree3_5.dll. The stack trace shows:

at ArrayList.InternalSetCapacity (Int32 value, Boolean updateVersion)
at ArrayList.EnsureCapacity (Int32 min)
at ArrayList.Add (Object value)
at String.Split (Char [] separator)
at AddParm (String str)

This happens in the workflow.

I registered a handler with AppDomain.CurrentDomain.UnhandledException in Main, but it does not exclude an exception.

, WinCE , , mscoree3_5.dll .

, AddParm, , AddParm , Split. - , AddParm, . , , AddParm , Try... Catch wrapping call , .

, , :

A native exception has occurred on BbCore.exe

At RuntimeType.InternalGetField(rt…)
At RuntimeType.InternalGetField(rt…)
At SRSupport.GetString()
At SRSupport.GetString()
At IPAddress.Parse(String ipString)

:

At CurrentSystemTimeZone.GetDaylightChanges(Int32 year)
At CurrentSystemTimeZone.GetUtcOffsetFromUniversalTime(DateTime time, Boolean& isAmbiguousLocalDst)
At CurrentSystemTimeZone.ToLocalTime(DateTime time)
At DateTime.ToLocalTime()
At DateTime.get_Now()
At MainLoop.timer1_Tick(Object sender, EventArgs e)
At Timer._WnProc(WM wm, Int32 wParam, Int32 lParam)
At ApplicationThreadContext._InternalContextMessages(WM wm, Int32 wParam, Int32 lParam)
At NativeMethods.GetMessage(MSG& lpMsg, IntPtr hWnd, UInt32 wMsgFilterMin, UInt32 wMsgFilterMax)
At Application2.Pump()
At Application2.RunMessageLoop(Boolean showForm)
At Application2.Run(Form mainForm, Boolean runAsSingletonApp, Boolean displayMainForm)
At Startup.Main()

Application2 OpenNetCF.Windows.Forms.dll. , .

, IPAddress.Parse Try... Catch, . , Parse , , , WindowsCE .

, , WinCE 6 R3 R2. , - R2, , , . - .

? , Try..Catch?

: , . ExceptionCode 0x80000002, , -, . , 1 . coredll.dll GlobalMemoryStatus, 29% (41 57 ). - , ? , , , , . OpenNetCF.ToolHelp.ProcessEntry.GetProcesses() 3,6 NK.exe 2,5 .

+3
3

, . # 8 . ++ 6 , 6 . , 4 . Doh!

, , .Net- .

. , .

( , , , . , JaredPar "", , . , , , , - , , , . : , , .)

+3

,

BbCore.exe

, , , . - , . , .

catch SEH , .

try { 
  ...
} catch { 

}

, , .

+1

​​ . , 256x256 64x64 , , .

0

Source: https://habr.com/ru/post/1732395/


All Articles