Author Topic: Unhandled Exception: System.ArgumentException: Parameter is not valid.  (Read 663 times)

needhmi

  • Newbie
  • *
  • Posts: 27
    • View Profile
Fairly often I get an unhandled exception error message, along with a white circle and red "X" through my compact gauge.  If I close out the form and reopen, sometimes it takes multiple times, it finally works fine.  Using 3.99w, ModBusRTU.  Driver Log file is attached in case it's helpful, I see the "send" has more data than the "receive" and the data doesn't match, but don't know what that means.  Does the max read group size have anything to do with this perhaps, I have it set at 50 for the log noted as such?  I changed that and the pollrate override to 0 and 5 respectively.  I changed the baud rate on the driver to match on the computer side in my device manager settings.  I'm suspecting it could be the PLC performance, but any other ideas or ways to match the HMI to what the PLC can do?  Thanks!

The full part of the exception text reads:
System.ArgumentException: Parameter is not valid.
   at System.Drawing.Graphics.set_Transform(Matrix value)
   at MfgControl.AdvancedHMI.Controls.MeterCompact.DrawNeedle(Graphics g, Single angle, Int32 cx, Int32 cy)
   at MfgControl.AdvancedHMI.Controls.GaugeCompact.PaintActiveContent(Graphics g)
   at MfgControl.AdvancedHMI.Controls.MeterCompact.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
« Last Edit: October 31, 2018, 06:41:31 PM by needhmi »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: Unhandled Exception: System.ArgumentException: Parameter is not valid.
« Reply #1 on: October 31, 2018, 06:30:03 PM »
It seems the value for the gauge is causing an exception when calculating the rotation angle of the needle. Do you know what the value is and what is your Minimum and Maximum values?

needhmi

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Unhandled Exception: System.ArgumentException: Parameter is not valid.
« Reply #2 on: October 31, 2018, 06:51:15 PM »
Correction - I am using 3.99w. 

The min real value can go negative, and I have tried building the gauge to match real (going negative) and leaving the min at zero instead- and get the problem with both.  Does the gauge need to be built with some buffer room (the ability to show below the min and above the max)?  It's a floating value and I have it scaled as well...   Using F4xxxx for the address.  Works fine at least half the time or better I would guess.   I just tried displaying the same address value with just an analog value display instead.  Getting a NaN value at times requiring the restart, but no unhandled exception.   

Thanks very much Archie for any further advice.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: Unhandled Exception: System.ArgumentException: Parameter is not valid.
« Reply #3 on: October 31, 2018, 07:03:27 PM »
I tried to replicate this problem with 3.99y Beta, but unable to. So I am going to recommend upgrading to 3.99x or 3.99y Beta to see if the problem continues

needhmi

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Unhandled Exception: System.ArgumentException: Parameter is not valid.
« Reply #4 on: October 31, 2018, 07:04:38 PM »
Ok thanks - The actual value does drop below the negative limits I have set before on the gauge at times.  I'll try making the limits beyond the actual value range and report back tomorrow.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: Unhandled Exception: System.ArgumentException: Parameter is not valid.
« Reply #5 on: October 31, 2018, 07:43:42 PM »
When I tested it I set values below the minimum and above to maximum to make sure it handled them correctly.

needhmi

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Unhandled Exception: System.ArgumentException: Parameter is not valid.
« Reply #6 on: November 03, 2018, 09:51:44 PM »
I had forgot that the value on the gauge is scaled when I thought it was dropping below the min - it actually wasn't according to a datalog I recorded.  The analog value display is working 100% so far.  Will update to 3.99x or 3.99y at some point and try the Gauge Compact some more.  Thanks for suggestions and the great HMI!