Badge notifications is not appearing on icon
I am using this piece of code to show badge count in my uwp app (Windows specification version - 1903)
Windows.Data.Xml.Dom.XmlDocument badgeXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeGlyph);
Windows.Data.Xml.Dom.XmlElement badgeElement = badgeXml.SelectSingleNode("/badge") as Windows.Data.Xml.Dom.XmlElement;
badgeElement.SetAttribute("value", ObjFactory.Instance.CreateRuntimeData().BadgeMessageCount.ToString());
BadgeNotification badge = new BadgeNotification(badgeXml);
BadgeUpdater badgeUpdater = BadgeUpdateManager.CreateBadgeUpdaterForApplication();
badgeUpdater.Update(badge);
This code initially shows badge count properly but sometime it disappear suddenly most of the time after exiting the application.
So is there anything changed in code because code runs properly but doesn't show badge count or is there any issue at the system level?