SfLinearProgressBar throws CoreGraphics.CGGradient Exception

Hi there,


I having just upgraded to the latest Xcode and am testing my app on iOS 15.2. I am receiving the exception `Could not initialize an instance of the type 'CoreGraphics.CGGradient': handle is null.` with the following stack trace:


```

  at ObjCRuntime.DisposableObject.InitializeHandle (System.IntPtr handle, System.Boolean verify) [0x00017] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/DisposableObject.cs:80

  at ObjCRuntime.DisposableObject..ctor (System.IntPtr handle, System.Boolean owns, System.Boolean verify) [0x00006] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/DisposableObject.cs:51

  at CoreFoundation.NativeObject..ctor (System.IntPtr handle, System.Boolean owns, System.Boolean verify) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/CoreFoundation/NativeObject.cs:46

  at CoreFoundation.NativeObject..ctor (System.IntPtr handle, System.Boolean owns) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/CoreFoundation/NativeObject.cs:41

  at CoreGraphics.CGGradient..ctor (CoreGraphics.CGColorSpace colorspace, CoreGraphics.CGColor[] colors, System.nfloat[] locations) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/CoreGraphics/CGGradient.cs:133

  at Syncfusion.iOS.ProgressBar.SfLinearProgressBar.CreateGradient (Syncfusion.iOS.ProgressBar.ProgressBarSegment segment, System.Drawing.RectangleF rect) [0x00342] in <de3640c7a12c4294b5d290566a8561a0>:0

  at Syncfusion.iOS.ProgressBar.SfLinearProgressBar.RenderSegment (Syncfusion.iOS.ProgressBar.DrawingContext context, System.Collections.ObjectModel.ObservableCollection`1[T] segments, UIKit.UIColor color, System.Boolean isProgress, System.Boolean canApplyPadding) [0x00054] in <de3640c7a12c4294b5d290566a8561a0>:0

  at Syncfusion.iOS.ProgressBar.SfLinearProgressBar.RenderProgressBar (Syncfusion.iOS.ProgressBar.DrawingContext drawing) [0x00038] in <de3640c7a12c4294b5d290566a8561a0>:0

  at Syncfusion.iOS.ProgressBar.SfLinearProgressBar.RenderSegment () [0x0004a] in <de3640c7a12c4294b5d290566a8561a0>:0

  at Syncfusion.iOS.ProgressBar.ProgressBarBase.Draw (CoreGraphics.CGRect rect) [0x00000] in <de3640c7a12c4294b5d290566a8561a0>:0

  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)

  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00013] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:73

  at Foo.iOS.Application.Main (System.String[] args) [0x00000] in C:\Code\Foo\Foo\Foo.iOS\Main.cs:13

```


The issue seems to be caused by SfLinearProgressBar. I am using version 19.4.0.40 of the Syncfusion component.


Hopefully you can help?


7 Replies

GR Gayathri Ramalingam Syncfusion Team January 4, 2022 05:22 PM UTC

Hi William,  
 
Thank you for using Syncfusion products. 
 
We tried to reproduce the issue “SfLinearProgressBar throws CoreGraphics.CGGradient Exception, but it is working fine as expected. 
  
We have created a simple sample based on the provided information and the sample can be downloaded from the below link.  
  
We created a video for illustrating the same and it can be downloaded from the below links, 
  
Kindly provide the following details to investigate further on this issue.   
1.      Modify / Simple sample with which the issue could be reproduced. 
2.      Replication procedure to reproduce the issue. 
3.      iOS device specification with the OS version. 
The above details will be more helpful for us to reproduce the issue in our side and assist you with the better solution at the earliest.   
 
 
With Regards, 
Gayathri R 
 
 



WI William January 5, 2022 11:20 AM UTC

Hi Gayathri,


I have created a sample demonstrating the issue here:  varyamereon/SfProgressBarIssue (github.com). I am seeing the issue on iOS only, and have tested with the simulator running 15.2 and a device running 15.1. No issue on Android.


Many thanks


Will



GR Gayathri Ramalingam Syncfusion Team January 7, 2022 01:47 AM UTC

Hi William, 
 
Thank you for your update. 
We tried to reproduce the issue “SfLinearProgressBar throws CoreGraphics.CGGradient Exception” with specified environment (Sample with simulator version 152.) as you mentioned in your last update, but it is working fine as expected.   
We created a video for illustrating the same and it can be downloaded from the below links,  
 
So, that we will setup a web meeting to look into the problem in that machine with which it could be reproduced and provide you the solution. Please let us know your availability. We will make every effort to have this scheduled on a date and time of your convenience.    
 
 
With Regards, 
Gayathri R 
 
 



WI William replied to Gayathri Ramalingam October 20, 2022 03:57 PM UTC

Hi Gayathri,


This issue still exists. It can be seen very clearly in the sample project provided. Here is a video of this occuring with the sample project: https://clipchamp.com/watch/OXUMn2o6Ouh.


(The video doesn't show the iOS simulator but the only action taken was to tap the 'increase progress' button once.)


Here is the stack trace:

```

at ObjCRuntime.DisposableObject.InitializeHandle (System.IntPtr handle, System.Boolean verify) [0x00017] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/ObjCRuntime/DisposableObject.cs:81

at ObjCRuntime.DisposableObject..ctor (System.IntPtr handle, System.Boolean owns, System.Boolean verify) [0x00006] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/ObjCRuntime/DisposableObject.cs:51

at CoreFoundation.NativeObject..ctor (System.IntPtr handle, System.Boolean owns, System.Boolean verify) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/CoreFoundation/NativeObject.cs:53

at CoreFoundation.NativeObject..ctor (System.IntPtr handle, System.Boolean owns) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/CoreFoundation/NativeObject.cs:48

at CoreGraphics.CGGradient..ctor (CoreGraphics.CGColorSpace colorspace, CoreGraphics.CGColor[] colors, System.nfloat[] locations) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/CoreGraphics/CGGradient.cs:140

at Syncfusion.iOS.ProgressBar.SfLinearProgressBar.CreateGradient (Syncfusion.iOS.ProgressBar.ProgressBarSegment segment, System.Drawing.RectangleF rect) [0x00342] in <37d56049291946279534231c64dc6475>:0

at Syncfusion.iOS.ProgressBar.SfLinearProgressBar.RenderSegment (Syncfusion.iOS.ProgressBar.DrawingContext context, System.Collections.ObjectModel.ObservableCollection`1[T] segments, UIKit.UIColor color, System.Boolean isProgress, System.Boolean canApplyPadding) [0x00054] in <37d56049291946279534231c64dc6475>:0

at Syncfusion.iOS.ProgressBar.SfLinearProgressBar.RenderProgressBar (Syncfusion.iOS.ProgressBar.DrawingContext drawing) [0x00038] in <37d56049291946279534231c64dc6475>:0

at Syncfusion.iOS.ProgressBar.SfLinearProgressBar.RenderSegment () [0x0004a] in <37d56049291946279534231c64dc6475>:0

at Syncfusion.iOS.ProgressBar.ProgressBarBase.Draw (CoreGraphics.CGRect rect) [0x00000] in <37d56049291946279534231c64dc6475>:0

at (wrapper managed-to-native) UIKit.UIApplication.xamarin_UIApplicationMain(int,string[],intptr,intptr,intptr&)

at UIKit.UIApplication.UIApplicationMain (System.Int32 argc, System.String[] argv, System.IntPtr principalClassName, System.IntPtr delegateClassName) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/UIKit/UIApplication.cs:57

at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/UIKit/UIApplication.cs:92

at SfProgressBarIssue.iOS.Application.Main (System.String[] args) [0x00001] in C:\Code\SfProgressBarIssue\SfProgressBarIssue\SfProgressBarIssue.iOS\Main.cs:17

```



HD Hemalatha Duraisamy Syncfusion Team October 21, 2022 02:57 PM UTC

Hi  William, 


Currently, we are checking on the issue "SfLinearProgressBar throws CoreGraphics.CGGradient Exception" and

we will update the further details on 27th October 2022.

Regards,

Hemalatha D.



HD Hemalatha Duraisamy Syncfusion Team October 27, 2022 04:37 PM UTC

Hi William,


We have analyzed the reported issue and found that the issue is not related to SfProgressBar control, and it’s related to the IOS 15 version. We are using CGGradient to draw a rectangle with radial and axial gradient fills in our control and confirmed that the issue occurred only with iOS 15.2 & above version. Once again, we have reported issue in the Xamarin iOS forum and will let you know once they provide a proper solution to this issue. And we will analyze any possible workaround solution for the issue.


Please find the bug report we created to track the status of this issue,

https://github.com/xamarin/xamarin-macios/issues/16497


Regards,

Hemalatha D.





WI William October 31, 2022 11:36 AM UTC

Thanks for the update Hemalatha, hopefully looking forward to a fix then.


Will


Loader.
Up arrow icon