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?
I've uploaded the document to this thread. I'm not familiar with your issue tracking system, so I'm not able to find it to upload this document to your tracking system, so if you could please forward this document along to your development team, I'd much appreciate it.
Thanks.
-Chris
Hi,
In order to attach your project in the forum you should go to the “Options” and click “Add/Update” button then you will be able to browse and attache the files you want to share.
I have also created a case (CAS-59390-Z17SYD) in our tracking system so you will be also able to attach it there.
Please let us know if you have any further questions or issues.
Sincerely,DimiDeveloper Support Engineer, MCPD Infragistics, Inc.www.infragistics.com/support
I've uploaded a zip with the project folder (validationleakdocumentation.zip) and 2 screenshots from my memory profiler (JetBrains dotTrace) that shows the held reference to my control (due to the unreleased ValidationResults) and the allocation stack trace that shows where this ValidationResults is being alocated and stored. Hopefully this is adaquate information.
I do not see how to attach it here to this message, so please give me instructions on how to do that.
I am not sure that I completely understand your scenario. If you upload a small project I will research your question and if needed I will forward it to our developers. If you do not want to upload your code here, I will create a case for you where we can continue that discussion.
Please let me know what is your decision.
Regards,
Stefaniya