C1Gauge Exception

Posted by: mx5 on 3 September 2019, 5:43 pm EST

    • Post Options:
    • Link

    Posted 3 September 2019, 5:43 pm EST

    Hi to all,

    i’m trying to use C1Gauge in VS2015 to represent data but sometimes when the application starts, I get an exception from System.Drawing where it is specified that the parameter “image” cannot be null. Instead of the object on the form, a red envelope is displayed. Can someone help me ?

    Thanks a lot :slight_smile:

  • Posted 4 September 2019, 8:15 pm EST

    Hello,

    Sorry but we could not replicate the issue at our end and also we never faced such an error before.

    I request you to provide a stripped down sample replicating the issue with the following details :

    1 : Build version of the control

    2 : Environment Details

    3 : Stack trace of the error.

    It will help us to narrow down the problem and help you in a better way.

    Regards,

    Prabhat Sharma.

  • Posted 5 September 2019, 2:59 am EST

    The control (WinForm version 4.0) is located on a tab, within a group box. To represent the data, when you click this tab page, a background tasks (trought a delegate because it is not the UI thread) try immediately to update the control. Now, i delay this operation by 200ms and the problem seems to be solved. If it were to occur again, I write here the exception that happens in runtime application.

    Hope this helps.

  • Posted 5 September 2019, 6:01 am EST - Updated 3 October 2022, 3:49 pm EST

    I can confirm tha if i cancel the delay the exception come back:

    System.ArgumentNullException: the value cannot be null.

    Parameter name: image

    in System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y)

    in C1.Win.C1Gauge.b.a(Graphics A_0, Int32 A_1, Int32 A_2, Boolean A_3, Boolean A_4, Image A_5, C1GaugeImageLayout A_6)

    in C1.Win.C1Gauge.C1Gauge.d(Graphics A_0)

    in C1.Win.C1Gauge.C1Gauge.OnPaint(PaintEventArgs pe)

    in System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)

    in System.Windows.Forms.Control.WmPaint(Message& m)

    in System.Windows.Forms.Control.WndProc(Message& m)

    in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

    in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

    in System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

  • Posted 5 September 2019, 10:34 pm EST

    Hello,

    Sorry I could not replicate the issue at my end in our created sample as per your given specifications without using any delay.

    Please provide your stripped down sample or modify the attached sample replicating the issue so that we can narrow down the problem.

    Regards,

    Prabhat Sharma.

    C1GaugeDemo.zip

  • Posted 6 September 2019, 6:24 am EST

    Sorry it was my mistake.

    I realized that in the delegate I had not imposed the

    
    if (InvokeRequired)
    {
       Invoke(new Action(delegate ()
       {
              //update control
       }));
    }
    
    

    before the update…i’m using another thread instead of the UI thread.

    Strange that he didn’t give me a cross-thread exception.

    But I believe the problem is due to this.

  • Posted 8 September 2019, 2:23 pm EST

    Hello,

    It’s nice to hear that problem has been solved at your end.

    If you need any other help, please let us know.

    Regards,

    Prabhat Sharma.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels