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
2150
UltraTextEditor causing forms to be created and disposed rapidly
posted

I have a WPF app with some winforms integration.  Occasionally I will open a legacy winforms Modal Form, lets call it "UfpProductPopupForWpf".

In some circumstances which I haven't been able to identify, the UltraTextEditor seems to create and dispose a whole ton of Windows Forms in the background, for no obvious reason.  See the Form disposal callstack below.  My theory at this time is that it happens when no other winforms cruft is created in the app.  However, if there is a WindowsFormsHost element visible somewhere on the screen already, I don't seem to get all the weird activity (creation and disposal of Windows Forms).   The difference in performance is around 30 seconds.

Here is a callstack:

>               System.Windows.Forms.dll!System.Windows.Forms.Form.Dispose(bool disposing)      Unknown

                System.dll!System.ComponentModel.Component.Dispose()            Unknown

                Infragistics4.Win.v16.1.dll!Infragistics.Win.DrawUtility.DecrementReferenceFormCounter()        Unknown

                Infragistics4.Win.v16.1.dll!Infragistics.Win.DrawUtility.ReleaseCachedGraphics(System.Drawing.Graphics g)       Unknown

                Infragistics4.Win.UltraWinEditors.v16.1.dll!Infragistics.Win.UltraWinEditors.TextEditorControlBase.ShouldAutoSizeHeight(out int height)         Unknown

                Infragistics4.Win.UltraWinEditors.v16.1.dll!Infragistics.Win.UltraWinEditors.TextEditorControlBase.SetBoundsCore(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified)           Unknown

                System.Windows.Forms.dll!System.Windows.Forms.Control.ScaleControl(System.Drawing.SizeF factor, System.Windows.Forms.BoundsSpecified specified) Unknown

                System.Windows.Forms.dll!System.Windows.Forms.Control.ScaleControl(System.Drawing.SizeF includedFactor, System.Drawing.SizeF excludedFactor, System.Windows.Forms.Control requestingControl)    Unknown

                System.Windows.Forms.dll!System.Windows.Forms.Control.Scale(System.Drawing.SizeF includedFactor, System.Drawing.SizeF excludedFactor, System.Windows.Forms.Control requestingControl)           Unknown

                System.Windows.Forms.dll!System.Windows.Forms.Control.ScaleChildControls(System.Drawing.SizeF includedFactor, System.Drawing.SizeF excludedFactor, System.Windows.Forms.Control requestingControl)              Unknown

                System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.Scale(System.Drawing.SizeF includedFactor, System.Drawing.SizeF excludedFactor, System.Windows.Forms.Control requestingControl)  Unknown

                System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.PerformAutoScale(bool includedBounds, bool excludedBounds)       Unknown

                System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.PerformNeededAutoScaleOnLayout() Unknown

                System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.OnLayoutResuming(bool performLayout)             Unknown

                System.Windows.Forms.dll!System.Windows.Forms.Control.ResumeLayout(bool performLayout)          Unknown

                UFP.LumberTrack.Shared.Windows.dll!UFP.LumberTrack.Shared.Windows.LookupControls.UfpBaseLookup.InitializeComponent() Line 96    C#

Notice the call to Infragistics.Win.DrawUtility.DecrementReferenceFormCounter which does seem to dispose of a form (which form? I do not know).  It gets called over and over for every UltraTextEditor.

There is no obvious impact to the behavior of the app other than a massive 30 second delay to open "UfpProductPopupForWpf" in some cases, and instant responses to open that form in others.

Any theories?  How can I get this thing to open fast in every case?

Parents
No Data
Reply
  • 2150
    Offline posted

    OK, here is what works.  If I open some random winforms modeless window and put it off to the side, with some random IG controls inside it, then all the performance problems simply go away!  From that point onwards, my WPF app can open and close a legacy winforms form (call it "UfpProductPopupForWpf") *without* a massive 30 second delay.  But if I neglect to have that random winforms window open, I get the delay.

    Taking it one step further I googled Infragistics winforms graphics caching and came up with a static method like so:

    Infragistics.Win.DrawUtility.BeginGraphicsCaching();

    It turns out that if I run this magical static method, it has the same effect as opening a random winforms window.  It makes my legacy winforms stuff open without any massive delays.

    So my strategy is now that I'm going to sprinkle this static method around my app like magical pixie dust and hope that it solves all my Infragistics winforms performance problems.  its a wonder that Infragistics doesn't just go ahead and do this on my behalf.  The overhead of running this is nothing compared to the massive delays that I was seeing before.  If anyone has used a better strategy for wpf integration, please let me know.

    Thanks, David

Children