Author Topic: system.ArgumentOutOfRangeException  (Read 1299 times)

mourazo

  • Newbie
  • *
  • Posts: 31
    • View Profile
system.ArgumentOutOfRangeException
« on: February 12, 2020, 02:51:12 PM »
I receive an exception in my program when its working one hour more or lest, I use basiclabels in my application and modbusRTUcom, the exception I receive is the following: System.ArgumentOutOfRangeException: 'The index was out of range. It must be a non-negative value and less than the size of the collection.
But it doesn't show me the code where it occurs, it shows me the following:
The application entered an interrupted state, but there is no code to display because all threads were executing external code (usually, system or frame code).
Can anyone help me? Thank you

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5323
    • View Profile
    • AdvancedHMI
Re: system.ArgumentOutOfRangeException
« Reply #1 on: February 12, 2020, 04:25:37 PM »
What version of AdvancedHMI?

Set EnableLogging property to True. Run the application until the error, then post the log file.

mourazo

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: system.ArgumentOutOfRangeException
« Reply #2 on: February 12, 2020, 05:08:51 PM »
I´m using advancedHmiv399xR1. I have just finished another debug test, the result has been the following exception at 90 minutes:
Thread 0x22a8 ended with code 0 (0x0).
'Masicos.exe' (CLR v4.0.30319: Masicos.exe): 'C: \ Windows \ Microsoft.Net \ assembly \ GAC_MSIL \ System.Transactions.resources \ v4.0_4.0.0.0_en_b77a5c561934e089 \ System.Transactions.resources. dll 'loaded. The module was compiled without symbols.
System.Transactions Critical: 0: <TraceRecord xmlns = "http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity = "Critical"> <TraceIdentifier> http://msdn.microsoft.com/TraceCodes / System / ActivityTracing / 2004/07 / Reliability / Exception / Unhandled </TraceIdentifier> <Description> Unhandled Exception </Description> <AppDomain> Masicos.exe </AppDomain> <Exception> <ExceptionType> System.OverflowException, mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089 </ExceptionType> <Message> The dimensions of the array exceeded the supported range. </Message> <StackTrace> in MfgControl.AdvancedHMI.Drivers.Modbus.RTU.ModbusRTUDataLinkLayer. a (Object A_0, SerialDataReceivedEventArgs A_1)
   in System.IO.Ports.SerialPort.CatchReceivedEvents (Object src, SerialDataReceivedEventArgs e)
   in System.IO.Ports.SerialStream.EventLoopRunner.CallReceiveEvents (Object state)
   in System.Threading.ExecutionContext.RunInternal (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   in System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   in System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem ()
   in System.Threading.ThreadPoolWorkQueue.Dispatch () </StackTrace> <ExceptionString> System.OverflowException: The dimensions of the array exceeded the supported range.
   in MfgControl.AdvancedHMI.Drivers.Modbus.RTU.ModbusRTUDataLinkLayer.a (Object A_0, SerialDataReceivedEventArgs A_1)
   in System.IO.Ports.SerialPort.CatchReceivedEvents (Object src, SerialDataReceivedEventArgs e)
   in System.IO.Ports.SerialStream.EventLoopRunner.CallReceiveEvents (Object state)
   in System.Threading.ExecutionContext.RunInternal (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   in System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   in System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem ()
   in System.Threading.ThreadPoolWorkQueue.Dispatch () </ExceptionString> </Exception> </TraceRecord>
Unhandled exception of type 'System.OverflowException' in MfgControl.AdvancedHMI.Drivers.dll
The dimensions of the matrix exceeded the allowed range.

The program '[8692] Masicos.exe' ended with code -1 (0xffffffff).

I will set the enabble logging true property to see the result in the following test.

mourazo

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: system.ArgumentOutOfRangeException
« Reply #3 on: February 12, 2020, 05:20:02 PM »
I just received another exception after 2 minutes of execution:

Unhandled exception: System.ArgumentException: The offset and length are outside the limits for this matrix or the count is greater than the number of elements from the index at the end of the source collection.
   in System.ThrowHelper.ThrowArgumentException (ExceptionResource resource)
   in MfgControl.AdvancedHMI.Drivers.Modbus.RTU.ModbusRTUDataLinkLayer.a (Object A_0, SerialDataReceivedEventArgs A_1)
   in System.IO.Ports.SerialPort.CatchReceivedEvents (Object src, SerialDataReceivedEventArgs e)
   in System.IO.Ports.SerialStream.EventLoopRunner.CallReceiveEvents (Object state)
   in System.Threading.ExecutionContext.RunInternal (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   in System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   in System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem ()
   in System.Threading.ThreadPoolWorkQueue.Dispatch ()
The program '[3636] Másicos.exe' ended with code 0 (0x0).
« Last Edit: February 12, 2020, 05:26:43 PM by mourazo »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5323
    • View Profile
    • AdvancedHMI
Re: system.ArgumentOutOfRangeException
« Reply #4 on: February 12, 2020, 05:34:06 PM »
I would say try version 3.99y Beta

The code referenced does not even exist in 3.99y, so something was fixed

mourazo

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: system.ArgumentOutOfRangeException
« Reply #5 on: February 13, 2020, 02:51:59 AM »
With the 399yBeta version i obtain this exception at the begin of the program

MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException: 'Send Queue Full'

In this part of code:

    Public Overrides Function BeginRead(ByVal startAddress As String, ByVal numberOfElements As Integer) As Integer
        Return MyBase.BeginRead(ReadTagAliases(startAddress), numberOfElements)
    End Function

I added try/catch empty to start the program andI'll do debug tests tonight (In Spain)
« Last Edit: February 13, 2020, 02:59:04 AM by mourazo »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5323
    • View Profile
    • AdvancedHMI
Re: system.ArgumentOutOfRangeException
« Reply #6 on: February 13, 2020, 03:53:41 AM »
You are flooding the communications faster than the device can respond. Either you need to add code to throttle your read to match the speed of the device or use Read

mourazo

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: system.ArgumentOutOfRangeException
« Reply #7 on: February 15, 2020, 06:36:44 AM »
Hello Archie, after testing the application 48 hours with the beta version everything works correctly. Thank you.