locked
Parameter is Not Valid - MDI Form Close RRS feed

  • Question

  • I get a 'Parameter not valid' erro when I close my MDI application.  I think it is an icon image, but I am not sure what form it is on.  Here si the exception detail:

     

    System.ArgumentException was unhandled
      Message="Parameter is not valid."
      Source="System.Drawing"
      StackTrace:
           at System.Drawing.Image.get_Width()
           at System.Drawing.Image.get_Size()
           at System.Windows.Forms.ToolStripItem.get_PreferredImageSize()
           at System.Windows.Forms.ToolStripItemInternalLayout.get_PreferredImageSize()
           at System.Windows.Forms.ToolStripItemInternalLayout.CommonLayoutOptions()
           at System.Windows.Forms.ToolStripItemInternalLayout.GetLayoutData()
           at System.Windows.Forms.ToolStripItemInternalLayout.PerformLayout()
           at System.Windows.Forms.ToolStripItemInternalLayout.EnsureLayout()
           at System.Windows.Forms.ToolStripItemInternalLayout.GetPreferredSize(Size constrainingSize)
           at System.Windows.Forms.ToolStripItem.GetPreferredSize(Size constrainingSize)
           at System.Windows.Forms.ToolStripButton.GetPreferredSize(Size constrainingSize)
           at System.Windows.Forms.ToolStripSplitStackLayout.CalculatePlacementsHorizontal()
           at System.Windows.Forms.ToolStripSplitStackLayout.LayoutHorizontal()
           at System.Windows.Forms.ToolStripSplitStackLayout.LayoutCore(IArrangedElement container, LayoutEventArgs layoutEventArgs)
           at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs)
           at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
           at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent)
           at System.Windows.Forms.ToolStrip.OnLayout(LayoutEventArgs e)
           at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
           at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
           at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
           at System.Windows.Forms.Control.OnResize(EventArgs e)
           at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
           at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
           at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
           at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
           at System.Windows.Forms.ToolStrip.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
           at System.Windows.Forms.ToolStrip.System.Windows.Forms.Layout.IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
           at System.Windows.Forms.Layout.DefaultLayout.xLayoutDockedControl(IArrangedElement element, Rectangle newElementBounds, Boolean measureOnly, Size& preferredSize, Rectangle& remainingBounds)
           at System.Windows.Forms.Layout.DefaultLayout.LayoutDockedControls(IArrangedElement container, Boolean measureOnly)
           at System.Windows.Forms.Layout.DefaultLayout.xLayout(IArrangedElement container, Boolean measureOnly, Size& preferredSize)
           at System.Windows.Forms.Layout.DefaultLayout.LayoutCore(IArrangedElement container, LayoutEventArgs args)
           at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs)
           at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
           at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent)
           at System.Windows.Forms.Form.OnLayout(LayoutEventArgs levent)
           at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
           at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
           at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
           at System.Windows.Forms.Control.OnResize(EventArgs e)
           at System.Windows.Forms.Form.OnResize(EventArgs e)
           at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
           at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
           at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
           at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
           at System.Windows.Forms.Form.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
           at System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
           at System.Windows.Forms.Control.set_Height(Int32 value)
           at Janus.Windows.Ribbon.OfficeFormAdorner.set_Form(Form value)
           at Janus.Windows.Ribbon.OfficeFormAdorner.Dispose(Boolean disposing)
           at System.ComponentModel.Component.Finalize()

    Where can I look to find what fom is causing the error?

     

    Thanks

    Saturday, January 12, 2008 6:24 PM

Answers

  • It is most likely here: Janus.Windows.Ribbon.OfficeFormAdorner.set_Form(Form value).
    Review your code in that function or if possible, post it here.

    Regards
    Saturday, January 12, 2008 7:05 PM

  • How do you know that the error starts there?

    Because that's what stack traces do... The trace the error from the top-most call to the function that caused the error.
    Although the crach occurs in the .NET library, it is caused by one of your functions, which are displayed at the bottom of the trace.


    I guess that is my question. And since this an MDI app, how do I know which form is causing the error?

    That's true. But you could output debug messages that show you details about the form.
    Or maybe you can try to repeoduce the problem with only a MDI child open.

    Regards
    Saturday, January 12, 2008 11:38 PM

All replies

  • It is most likely here: Janus.Windows.Ribbon.OfficeFormAdorner.set_Form(Form value).
    Review your code in that function or if possible, post it here.

    Regards
    Saturday, January 12, 2008 7:05 PM
  • That seemed to be it.removed & ran the project...no error.

     

    I added it back in & no error...

     

    Must have been a glitch.

     

    Thanks

     

    Saturday, January 12, 2008 9:00 PM
  • Hello,

    Maybe the crash doesn't occur all the time...

    Regards
    Saturday, January 12, 2008 9:06 PM
  • Actually, that is true.  It just happened again.  Seems random & I cannont pinpoint it Sad

     

    Is there a way to trace it back?

     

    Thanks!

     

    Saturday, January 12, 2008 10:20 PM

  • Is there a way to trace it back?


    Yes, here's where it starts:
          at Janus.Windows.Ribbon.OfficeFormAdorner.set_Form(Form value)
           at Janus.Windows.Ribbon.OfficeFormAdorner.Dispose(Boolean disposing)

    Isn't this your code?
    Whatever you do in set_Form crashes the application when you close it. Maybe some object instance that is no longer initialized, etc...
    If you can't post the code then at least try to review it and identify potential vulnerablities.

    Regards
    Saturday, January 12, 2008 10:23 PM
  •  

    Marcel-

     

    That is the stack trace error: 

     

    Sorry...should have been more specific.

     

    How do you know that the error starts there?  I guess that is my question. And since this an MDI app, how do I know which form is causing the error?

     

    Thanks

    Saturday, January 12, 2008 11:33 PM

  • How do you know that the error starts there?

    Because that's what stack traces do... The trace the error from the top-most call to the function that caused the error.
    Although the crach occurs in the .NET library, it is caused by one of your functions, which are displayed at the bottom of the trace.


    I guess that is my question. And since this an MDI app, how do I know which form is causing the error?

    That's true. But you could output debug messages that show you details about the form.
    Or maybe you can try to repeoduce the problem with only a MDI child open.

    Regards
    Saturday, January 12, 2008 11:38 PM
  • Thanks for your help Marcel...never rally understood the stack traces.

     

    I will try it with an MDI Child & see what happens.

     

    V

     

    Saturday, January 12, 2008 11:44 PM