Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
Validation results in reference leak in ValidationManager
posted

Using Infragistics v8.2

All,

 I'm currently working on an application which has form validation.  One of the fields uses a specific UltraValidator to ensure that the validation is between 1 and 365:

        private void SetValidation()
        {
            m_cycleValidator = new UltraValidator();
            m_cycleValidator.ValidationTrigger = ValidationTrigger.Programmatic;
            ValidationSettings settings = m_cycleValidator.GetValidationSettings(m_ratingNextReviewTb);
            settings.Reset();
            settings.Condition = new RangeCondition(1.0, 365.0, Type.GetType("System.Double"));
            settings.NotificationSettings.Caption = "Next Review Cycle must be between 1 and 365 days.";
            settings.ValidationPropertyName = "Text";
            settings.IsRequired = false;
            settings.EmptyValueCriteria = EmptyValueCriteria.NullOrEmptyString;
            settings.NotificationSettings.Image = Properties.Resources.incomplete;
        }

 

The issue is that when this validator is set on the control (m_ratingNextReviewTb) the UserControl can never be released.  

Looking at the dotTrace output from my memory profiler, it appears that there is an unusedValidationResult stored in Infragistics.Win.Misc.ValidationManager which refers back to my ValidationSettings which referers back to my UltraTextEditor which is holding an event handler back to my user control. Because of this, It can't be garbage collected.

This unulsedValidationResult i believe is being created when the control is painted and it is calling IsValid() to determine how it should draw the control (putting the image icon, for example).  if I don't set this validation settings on the UltraTextEditor, the unusedValidationResult object is not allocated and then there's no root path back to my Control so it can get garbage collected.

My question is:  how can I dispose of this 'unusedValidationResult' instance that's behing held by Infragistics.Win.Misc.ValidationManager so that there is no Root path back to my user control and it can get garbage collected?

Note: I could go to the ultratexteditor (m_ratingNextReviewTb) instance in my user control and figure out how to remove the event from it to my userControl, but that's not fixing the leak to the UltraTextEditor instance.  The core problem is i need to get rid of the refernce held by ValidationManager.

Can anyone help with this?

 

Parents Reply Children