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. Image for the cookie policy date

Runtime crash but only in Release mode

I have a new Xamarin Forms Android app I'm working on, works great when run in Debug but when in Release mode, consistently crashes.  I've narrowed down the line that causes the crash to be where I'm defining the Primary Axis on a chart:

        private SfChart AddChart(int AccountId, string metric)
        {
            SfChart chart = new SfChart();
            chart.PrimaryAxis = new CategoryAxis();   //  <=== Crashes here
            chart.SecondaryAxis = new NumericalAxis();

Here's the start of the stack trace extracted from logcat.  At a complete loss as to how to resolve since it works perfectly when not running in 'Release' mode.  Using a licensed Community License version.  I've played around with matching the Linker to the same settings as used by Debug, but the same problem.  I'm stumped.

01-20 20:58:01.205: E/AndroidRuntime(8853): java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
01-20 20:58:01.205: E/AndroidRuntime(8853): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
01-20 20:58:01.205: E/AndroidRuntime(8853): Caused by: java.lang.reflect.InvocationTargetException
01-20 20:58:01.205: E/AndroidRuntime(8853): at java.lang.reflect.Method.invoke(Native Method)
01-20 20:58:01.205: E/AndroidRuntime(8853): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
01-20 20:58:01.205: E/AndroidRuntime(8853): ... 1 more
01-20 20:58:01.205: E/AndroidRuntime(8853): Caused by: android.runtime.JavaProxyThrowable: System.ArgumentException: Set Method not found for 'NativeObject'
01-20 20:58:01.205: E/AndroidRuntime(8853):   at System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x00029] in <5a880efca80f49e7b955a9ffbdc82de9>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value) [0x00000] in <5a880efca80f49e7b955a9ffbdc82de9>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at Syncfusion.SfChart.XForms.Droid.SfChartRenderer.SetNativeObject (System.Type type, System.Object obj, System.Object nativeObject) [0x0001b] in <c50628162fa446adb41dcf53a3feb2a2>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at Syncfusion.SfChart.XForms.Droid.SfChartMapping.OnChartPropertiesChanged (System.String propertyName, Syncfusion.SfChart.XForms.SfChart formsChart, Com.Syncfusion.Charts.SfChart nativeChart) [0x00025] in <c50628162fa446adb41dcf53a3feb2a2>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at Syncfusion.SfChart.XForms.Droid.SfChartRenderer.GetNativeChart (Syncfusion.SfChart.XForms.SfChart sfChart) [0x00077] in <c50628162fa446adb41dcf53a3feb2a2>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at Syncfusion.SfChart.XForms.Droid.SfChartRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e) [0x0003d] in <c50628162fa446adb41dcf53a3feb2a2>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000fc] in <556464d784854d58957ce21f4c5eb182>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in <556464d784854d58957ce21f4c5eb182>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in <556464d784854d58957ce21f4c5eb182>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in <556464d784854d58957ce21f4c5eb182>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x0010d] in <556464d784854d58957ce21f4c5eb182>:0 
01-20 20:58:01.205: E/AndroidRuntime(8853):   at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x0000d] in <556464d784854d58957ce21f4c5eb182>:0 

8 Replies

JR Jens Ratsey January 21, 2017 01:48 PM UTC

I've raised a support ticket for the same.


PS Parthiban Sundaram Syncfusion Team January 23, 2017 01:59 PM UTC

Hi Jens,

Thanks for using Syncfusion products.

We were unable to reproduce the reported issue. We have prepared a sample for this. Please update the modified sample to reproduce the issue which will be helpful to provide a solution.

Sample: http://www.syncfusion.com/downloads/support/directtrac/171235/ze/RunTimeChart-192164410  

Regards,
Parthiban S.  



JR Jens Ratsey January 24, 2017 01:25 AM UTC

Parthiban -

Thanks for the prompt response.  I can confirm that your sample does indeed run without issue.  I will look to replicate as much of my application in your sample in an attempt to reproduce the issue.

J.


PN Preethi Nesakkan Gnanadurai Syncfusion Team January 24, 2017 03:56 AM UTC

Hi Jens,  
  
Most Welcome. 
Please let us know if you need further assistance on this. 
  
Regards,  
Preethi 
  
  



JR Jens Ratsey January 26, 2017 01:19 PM UTC

I've updated the support ticket but wanted to add here for future reference.  The cause of this crash appears to me to be linker related, as I originally thought.  Setting the linker to 'Sdk and User Assemblies' will cause the Syncfusion supplied example to crash with the same error.  This explains why it was running for me in Debug since the linker is not active there.

Switch the linker properties to 'Sdk Assemblies Only' and the application will run without issue.  Not ideal, but a workaround until the underlying issue might be resolved.


PS Parthiban Sundaram Syncfusion Team January 27, 2017 12:30 PM UTC

Hi Jens,

Please follow the incident created with the same issue under direct trac account. 

Please let us know if you have any concerns.

Regards,
Parthiban S


EM Emil September 9, 2017 10:16 AM UTC

what is the solution for this please? I am also using full linking and having same issue



PS Parthiban Sundaram Syncfusion Team September 11, 2017 11:27 AM UTC

Hi Emil,

Thanks for contacting Syncfusion support.

We have created an incident under your Direct Trac account. So, we request to follow the incident for further details.

Our Direct Trac support system can be accessed from the following link:

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

Regards,
Parthiban S


Loader.
Live Chat Icon For mobile
Up arrow icon