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
close icon

SfPopupLayout Exception

PLEASE READ UNTIL THE END.

I tried using SfPopupLayout control (17.2.0.51) in a Xamarin UWP application and it threw an exception.

1. To be sure it wasn't a problem in my code I created a BARE PAGE with only the SfPopupLayout and the
exception was still happening. It was a default SfPopupLayout. No properties or anything was changed.

2. I tried both using it as a root view and as a popup on the go. Both failed.

3. So, I went on to figure out were in the SfPopupLayout's IL the problem was occurring.

4. It turns out that the SfPopupLayout is trying to use System.Convert.ToByte() with a value of 20400. That's not a byte!

5. The value of 20400 comes from a calculation using PopupView.PopupStyle.OverlayOpacity. I did not set it to any
value in My code! So, it comes from the SfPopupLayout's code.

6. The problem is the PopupView.PopupStyle.OverlayOpacity has a value of 80!

7. The exception occurs because of the code in the SfPopupLayout ApplyBackgroundColor method.

The code is this, PopupView.PopupStyle.OverlayOpacity * (double) byte.MaxValue
Which translates to this, 80 * 255 = 20400.

8. It seems that the only valid value for PopupView.PopupStyle.OverlayOpacity would be 0 or 1

9. BELOW LISTED IS THE EXCEPTION AND A WORK-AROUND I CREATED TO PROVE THIS PROBLEM.
THE WORK-AROUND MAKES THE EXCEPTION NOT OCCUR.

NOTE THAT THE WORKAROUND IS FOR XAML. I COULDN'T GET A WORK-AROUND TO WORK AT
ALL FOR A POPUP ON THE GO.

10. I hope I've given enough information to re-create. If I've gotten something wrong or I'm mistaken please
let me know.

Thanks

System.OverflowException
HResult=0x80131516
Message=Value was either too large or too small for an unsigned byte.
Source=System.Private.CoreLib
StackTrace:
at System.Convert.ThrowByteOverflowException() in E:\A\_work\414\s\src\mscorlib\shared\System\Convert.cs:line 383
at System.Convert.ToByte(Int32 value) in E:\A\_work\414\s\src\mscorlib\shared\System\Convert.cs:line 808
at System.Convert.ToByte(Double value) in E:\A\_work\414\s\src\mscorlib\shared\System\Convert.cs:line 839
at Syncfusion.XForms.UWP.PopupLayout.SfPopupLayout.ApplyBackgroundColor(SolidColorBrush color)
at Syncfusion.XForms.UWP.PopupLayout.SfPopupLayout.SetContainerBackgroundColor() in C:\Users\Kcarter\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\E5AD1806-4E87-4550-9AE5-8BB600C7AE0D\15\72836b0e\SfPopupLayout.cs:line 530
at Syncfusion.XForms.UWP.PopupLayout.SfPopupLayout.DisplayPopup() in C:\Users\Kcarter\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\E5AD1806-4E87-4550-9AE5-8BB600C7AE0D\15\72836b0e\SfPopupLayout.cs:line 471
at Syncfusion.XForms.UWP.PopupLayout.SfPopupLayout.set_IsOpen(Boolean value) in C:\Users\Kcarter\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\E5AD1806-4E87-4550-9AE5-8BB600C7AE0D\15\72836b0e\SfPopupLayout.cs:line 154
at Syncfusion.XForms.UWP.PopupLayout.SfPopupLayout.OpenOrClosePopup(Boolean open) in C:\Users\Kcarter\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\E5AD1806-4E87-4550-9AE5-8BB600C7AE0D\15\72836b0e\SfPopupLayout.cs:line 381
at Syncfusion.XForms.UWP.PopupLayout.SfPopupLayout.Show() in C:\Users\Kcarter\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\E5AD1806-4E87-4550-9AE5-8BB600C7AE0D\15\72836b0e\SfPopupLayout.cs:line 245
at Syncfusion.XForms.UWP.PopupLayout.PopupLayoutDependencyService.Show(Object nativeObject, SfPopupLayout formsPopup) in C:\Users\Kcarter\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\E5AD1806-4E87-4550-9AE5-8BB600C7AE0D\5d\7462185a\PopupLayoutDependencyService.cs:line 57
at Syncfusion.XForms.PopupLayout.SfPopupLayout.Show(Boolean isFullScreen)
at Syncfusion.XForms.PopupLayout.SfPopupLayout.OnIsOpenChanged(BindableObject bindable, Object oldValue, Object newValue)
at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
at Xamarin.Forms.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
at Xamarin.Forms.BindableObject.SetValue(BindableProperty property, Object value)
at Syncfusion.XForms.PopupLayout.SfPopupLayout.set_IsOpen(Boolean value)
at CWMatthews.StarterTemplate.CrossPlatformNetStandard.Views.Original.EquipmentManager.EquipmentManagerMainPageDetailView.Button_Clicked(Object sender, EventArgs e) in D:\Documents\Starter Template\C. W. Matthews Starter Template .Net Standard Views - Standalone\Views Sub Apps\Equipment Manager\EquipmentManagerMainPageDetailView.xaml.cs:line 584
at Xamarin.Forms.Button.Xamarin.Forms.Internals.IButtonElement.PropagateUpClicked()
at Xamarin.Forms.ButtonElement.ElementClicked(VisualElement visualElement, IButtonElement ButtonElementManager)
at Xamarin.Forms.Button.SendClicked()
at Xamarin.Forms.Platform.UWP.ButtonRenderer.OnButtonClick(Object sender, RoutedEventArgs e)

IF I ADD THIS TO THE XAML, THE EXCEPTION DOES NOT OCCUR.

   sfpopup:SfPopupLayout.PopupView
               sfpopup:PopupView
            sfpopup:PopupView.PopupStyle
                sfpopup:PopupStyle OverlayOpacity="0"
            sfpopup:PopupStyle
            sfpopup:PopupView.PopupStyle
        sfpopup:PopupView
    sfpopup:SfPopupLayout.PopupView

I left out the angle brackets because I get an error when posting with them.
   

3 Replies

KK Karthikraja Kalaimani Syncfusion Team September 26, 2019 08:56 AM UTC

Hi Carter,

Sorry for the inconvenience caused. 
 
We have already fixed this issue and included in our 2019 Volume 3 beta release, which is available for download now. 
  
Please find the below Volume 3 2019 Beta Release link. 
 
 
We hope this helps. Please let us know, if you need any further assistance.

Regards, 
Karthik Raja 



CH Christian September 27, 2019 06:10 PM UTC

when is this expected to be pushed out in your nuget packages?

Thanks


FP Farjana Parveen Ayubb Syncfusion Team September 30, 2019 06:59 AM UTC

Hi Carter 
  
Thank you for your update.  
  
We have already pushed the 2019 Volume 3 beta release NuGet into nuget.org. You have to enable the Include prerelease in your NuGet package manager, for Syncfusion beta release NuGet packages. Please refer the below screen shot  
 
 
 
 
Please let us know if you need any further details on this. 
 
Regards, 
Farjana Parveen A 


Loader.
Live Chat Icon For mobile
Up arrow icon