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?
Hi,
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
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.
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 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
Hello Cris,
Thank you for the sample.
Just to let you know that you would be able to find your case in our system following the steps below:
1.Go to www.Infragistics.com
2.Hover over "My IG" and click "My Support Activity".
3.Under the "Active" Tab you would be able to find your case.
Once I have more information for you I will update you here or through your case.
Do any of you care to share the results with others?
I am having simmilar issues with the ValidationManager having too many references to other controls that are disposed but not garbage collected because of Validation manager.
Thanks
Hello Jankol,
Would it be possible for you to provide us, the application that you are testing, or a similar one, that behaves the same, so we would be able to test and see your current scenario at our end and research it further for you.If you have any other questions please feel free to let us know.
We are using Infragistics 11.2.
I am also using MemoryProfiler 4.0 to find potential memory leaks in our application.
As it seems, all of our forms and usercontrols, are Disposed after closing them, but not GarbageCollected due to the referanse to ValidationManager, so they stay in memory.
The issue here was in the version used - NetAdvantage for Windows Forms2008 vol2 which has an issue which has been fixed in some point, and it was verified there weren't such issues with NetAdvantage for Windows Forms 2010 vol.3Could you please let me know what version of the Infragistics controls you are currently using in your application? Also please take a look at our product lifecycle page at :
http://ko.infragistics.com/support/product-lifecycle.aspx#ProductLifecycle
If you have any other questions please feel free to let us know.