SfBadge Visibility="Collapsed" Exception

Running v19.2.0.55, I'm trying to hide the badge.


This XAML works:

<Button Width="30">
                <syncfusion:SfBadge.Badge>
                  <syncfusion:SfBadge
                    x:Name="badge"
                    Content="10" />
                </syncfusion:SfBadge.Badge>
              </Button>

This XAML does not:

<Button Width="30">
                <syncfusion:SfBadge.Badge>
                  <syncfusion:SfBadge
                    x:Name="badge"
                    Content="10"
                    Visibility="Collapsed" />
                </syncfusion:SfBadge.Badge>
              </Button>


It throws the following exception:

System.ArgumentException

HResult=0x80070057

Message=Must disconnect specified child from current parent Visual before attaching to new parent Visual.

Source=PresentationCore

StackTrace:

at System.Windows.Media.Visual.AddVisualChild(Visual child)

at Syncfusion.Windows.Controls.Notification.BadgeAdorner.<.ctor>b__0(Object sender, RoutedEventArgs e)

at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)

at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

at System.Windows.Threading.DispatcherOperation.InvokeImpl()

at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)

at System.Windows.Threading.DispatcherOperation.Invoke()

at System.Windows.Threading.Dispatcher.ProcessQueue()

at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)

at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)

at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)

at System.Windows.Application.RunDispatcher(Object ignore)

at System.Windows.Application.RunInternal(Window window)

at RepoWare.UI.App.Main()


This exception was originally thrown at this call stack:

[External Code]


2 Replies

SN Sudharsan Narayanan Syncfusion Team September 17, 2021 11:54 AM UTC

Hi Don,

From our end, we checked the reported issue of "Exception throws when set Visibility to Collapse." The reported issue has already been resolved on our end, and it will be included in our next upcoming release. It is planned to be released at the end of September. We will let you know once the release rolled out.

We appreciate your patience until then.


Regards,
 
Sudharsan


SN Sudharsan Narayanan Syncfusion Team September 30, 2021 11:44 AM UTC

Hi Don, 
 
We are glad to announce that our Essential Studio 2021 Volume 3 Main Release v19.3.0.43 is rolled out with the reported issue bug “SfBadge visibility throws exception” and is included, available for download under the following link. 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards,
Sudharsan
 


Loader.
Up arrow icon