New Posts New Posts RSS Feed: ArgumentNullException when calling Dispose
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

ArgumentNullException when calling Dispose

 Post Reply Post Reply
Author
f3rland View Drop Down
Newbie
Newbie
Avatar

Joined: 13-Sep-2007
Location: Canada
Posts: 25
Post Options Post Options   Quote f3rland Quote  Post ReplyReply Direct Link To This Post Topic: ArgumentNullException when calling Dispose
    Posted: 26-Aug-2009 at 12:36pm
Using : DevForce 3.6.7.1 & DevExpress 9.1.3

I get an exception when trying to dispose a IdeaBlade.UI.WinForms.DevExpressControls.XtraGridBindingManager object :

   à System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   à System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   à System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   à IdeaBlade.UI.WinForms.DevExpressControls.XtraGridColumnBinder.UnRegisterEvents(RepositoryItem pRepositoryItem)
   à IdeaBlade.UI.WinForms.DevExpressControls.XtraGridBindingManager.Dispose(Boolean disposing)
   à System.ComponentModel.Component.Dispose()

How to properly dispose XtraGridBindingManager object?
F3
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 01-Sep-2009 at 7:48pm

Dispose will work correctly if you construct the XtraGridBindingManager using the constructor which accepts an IContainer, e.g.,

   myXgbm = new XtraGridBindingManager(this.components);
 
This is actually the constructor used by the XtraGridBindingManager designer when it auto-generates code.  Using this constructor, dispose will also automatically be called when the container is disposed.
 
(The fact that Dispose does not work correctly when other constructors are used is a bug.)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down