We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfLinearGauge Unhandled exception.

Thread ID:

Created:

Updated:

Platform:

Replies:

129788 Apr 3,2017 08:36 PM UTC Apr 7,2017 05:43 AM UTC Xamarin.Forms 6
loading
Tags: SfLinearGauge
Don Robb
Asked On April 3, 2017 08:36 PM UTC

I'm wondering if someone can help me with a problem I have been facing during the evaluation of the SFLinearGauge control.  I have the following code that works fine in my xamarin forms android app.                                                                                                                                                                                             <linear:SfLinearGauge   x:Name="linearGauge" Scale="1.0" Orientation="OrientationVertical"  Grid.Row="0" Grid.Column="2"  Grid.RowSpan="2">
            <linear:SfLinearGauge.Scales>
                <linear:LinearScale  LabelFontSize="40" LabelColor="White" x:Name="scale" MinimumValue="0" MaximumValue="80" Interval="10"  ScaleBarLength="80" ScaleBarColor="#FAECEC" MinorTicksPerInterval="1" ScaleBarSize="13" ScalePosition="BackWard" >
                    <linear:LinearScale.Pointers>
                        <linear:BarPointer x:Name="rangePointer" Value="50" Color="Lime"  Thickness="30" />
                    </linear:LinearScale.Pointers>
                </linear:LinearScale>
            </linear:SfLinearGauge.Scales>

        </linear:SfLinearGauge>
                                                        
                                                                                                                                                                                                                                                                            I get a Unhandled exception when running using the Visual studio 2015 debugger.  when I add a data binding to the Value field as follows                                                                                                                                                                                                      <linear:SfLinearGauge   x:Name="linearGauge" Scale="1.0" Orientation="OrientationVertical"  Grid.Row="0" Grid.Column="2"  Grid.RowSpan="2">
            <linear:SfLinearGauge.Scales>
                <linear:LinearScale  LabelFontSize="40" LabelColor="White" x:Name="scale" MinimumValue="0" MaximumValue="80" Interval="10"  ScaleBarLength="80" ScaleBarColor="#FAECEC" MinorTicksPerInterval="1" ScaleBarSize="13" ScalePosition="BackWard" >
                    <linear:LinearScale.Pointers>
                        <linear:BarPointer x:Name="rangePointer" Value="{Binding Path=VBATVDCGAUGE}" Color="Lime"  Thickness="30" />
                    </linear:LinearScale.Pointers>
                </linear:LinearScale>
            </linear:SfLinearGauge.Scales>
        </linear:SfLinearGauge>
                                                                                                                                                                                                                                     My program runs for a random amount of time and then crashes with an un handled exception error.    Can someone please help me with this?

Don Robb
Replied On April 3, 2017 08:37 PM UTC

Sorry to reply to my own thread.  I just figured out how to get the stack trace.

04-03 16:15:08.263 I/MonoDroid( 2790): System.ArgumentException: Handle must be valid.
04-03 16:15:08.263 I/MonoDroid( 2790): Parameter name: instance
04-03 16:15:08.263 I/MonoDroid( 2790):   at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00017] in /Users/builder/data/lanes/4009/9578cdcd/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:11250 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Android.Runtime.JNIEnv.CallObjectMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x00000] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/JNIEnv.g.cs:96 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Com.Syncfusion.Gauges.SfLinearGauge.SfLinearGauge.get_Scales () [0x00043] in <ce5ed823511d4d16a435ae98590f0ff3>:0 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Syncfusion.SfGauge.XForms.Droid.LinearPointerMapping.OnPointerPropertiesChanged (System.String propertyName, Syncfusion.SfGauge.XForms.BarPointer formPointer, Com.Syncfusion.Gauges.SfLinearGauge.BarPointer nativePointer) [0x00015] in <015c3ebcef374cfcbdc1e314edc290e8>:0 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Syncfusion.SfGauge.XForms.Droid.LinearScaleMapping.FormPointer_PropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00079] in <015c3ebcef374cfcbdc1e314edc290e8>:0 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:137 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.BindableObject+SetValueFlags attributes, System.Boolean silent) [0x000f4] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:581 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.BindableObject+SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0014b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:378 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:173 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:55 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__47_0 () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:542 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/4009/9578cdcd/source/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36 
04-03 16:15:08.263 I/MonoDroid( 2790):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/platforms/android-25/src/generated/Java.Lang.IRunnable.cs:81 
04-03 16:15:08.263 I/MonoDroid( 2790):   at (wrapper dynamic-method) System.Object:b199fbca-09af-4706-b3e3-7c0d9643e798 (intptr,intptr)


Ashwin Kumaravel [Syncfusion]
Replied On April 5, 2017 06:41 AM UTC

Hi Don,

Thank you for using Syncfusion products.

We were unable to reproduce the reported issue “SfLinearGauge Unhandled exception” from your code snippet at our end.
We have created a testing sample based on your requirement and can be downloaded from the below location  
Sample: http://www.syncfusion.com/downloads/support/forum/129788/ze/LinearGauge-1108098612.zip  

Since the issue is not reproduced at our end, we would like to know the following details, which will helpful in further analysis and to provide the solution sooner.
 
- Modify the attached sample to replicate your scenario
- Or provide your sample along with replication steps.
 

Regards,
Ashwin.k 


Don Robb
Replied On April 5, 2017 01:45 PM UTC

Thanks for the reply and example.  The difference between your example and my code is that I am writing the bindable property over and over again at a rate of about one second with different values.  I get the exception for which I posted the stack trace at a random time.  It works for awhile and then the exception is thrown.  The other difference is my accessor  is a double.  Is that ok?  

This is my accessor

   public class ParametersViewModel : ViewModelBase
    {
        double vbatvdcgauge;
        double _vbatvdcgauge;

        public double VBATVDCGAUGE  // Parmeter 1
        {
            set
            {
                if (SetProperty(ref vbatvdcgauge, value))
                {

                    _vbatvdcgauge = vbatvdcgauge * 0.0078125;

                    _vbatvdcgauge = Math.Round(_vbatvdcgauge, 0);
                    System.Diagnostics.Debug.WriteLine("_vbatvdcgauge = {0}", _vbatvdcgauge.ToString());
                }
            }
            get
            {
                return _vbatvdcgauge;
            }
        }

     }

  public class ViewModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
        {
      //     if (Object.Equals(storage, value))
        //        return false;
            storage = value;
            OnPropertyChanged(propertyName);
            return true;
        }
        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {

                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

Ashwin Kumaravel [Syncfusion]
Replied On April 6, 2017 12:50 PM UTC

Hi Don,

We have modified our sample based on your code snippet, still we could not able to reproduce the reported issue.We have created a testing sample based on your requirement and can be downloaded from the below location

Sample-Linear

Can you please modify the attached sample to replicate the issue?

We would like to know the following details from your side,
1)Assembly version,
2)Device configuration-In which you have deployed the sample
3)OS version

Regards,
Ashwin.k

Don Robb
Replied On April 6, 2017 05:35 PM UTC

I have a attached a project that is able to cause the exception.   To cause the exception.

1.     Use the menu button I have provided to launch the gauge screen.  
2.     Navigate back to the menu page. and the exception I am seeing will happen. 

The code I have provided causes the exception when navigating away from the page that has the gauge.  In my app code (not the example I have provided) I do something similar.  I navigate back and fourth between the menu and  the gauge screen while constantly updating my view model.  In my app the exception happens at a random time but in the example I have provided it happens write away when you click the back arrow.     I can only assume that your SFLinearGauge module is still updating via the bindable property  when the page is navigated away from and it thinks there is an invalid handle or something.  Xamarin forms native modules allow you to continue to update your view model even though the page that it is bound too has been navigated away from.  SFLinearGauge causes the exception I have posted when the page is navigated away from.   I don't think this is correct behaviour. 




Attachment: LinearGauge1108098612_7d56008c.zip

Ashwin Kumaravel [Syncfusion]
Replied On April 7, 2017 05:43 AM UTC

Hi Don,

We are deeply regret for the inconvenience caused.

We were able to reproduce the reported issue “SfLinearGauge Unhandled exception” at our end. And we have logged a defect report regarding the same. A support incident to track the status of this defect has been created under your account. 

Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents/   

Regards,
Ashwin.k


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;