Browsable attribute breaking change?

There seems to be either a bug or a breaking change with the Browsable attribute.

With V1.1 of the Framework, we could mark properties with Browsable(false) and they would not be displayed in a PropertyGrid. Worked great.

Now, with V2.0 of the Framework, nothing can bind to a property that's marked with Browsable(false). An exception is thrown from BindToObject.CheckBinding (see below). The exception and stack trace is exactly what you get if the property doesn't exist.

I get the exception if I run my V1.1 application against the V2.0 Framework and when I recompile my app with the V2.0 framework.

I don't see this documented in the V2.0 Breaking Changes documentation so I think it's bug. Is it a known bug Are there any workarounds Is it likely to be fixed The only solution that I've found is to remove the Browsable(false) attribute which makes my app work but, you won't be able to use the objects with a PropertyGrid (or DataGridView).

Thanks,

John Vottero

Here is the complete stack trace:

Cannot bind to the property or column LoadedFrom on the DataSource.
Parameter name: dataMember

Stack Trace:
at System.Windows.Forms.BindToObject.CheckBinding()
at System.Windows.Forms.BindToObject.SetBindingManagerBase(BindingManagerBase lManager)
at System.Windows.Forms.Binding.SetListManager(BindingManagerBase bindingManagerBase)
at System.Windows.Forms.ListManagerBindingsCollection.AddCore(Binding dataBinding)
at System.Windows.Forms.BindingsCollection.Add(Binding binding)
at System.Windows.Forms.BindingContext.UpdateBinding(BindingContext newBindingContext, Binding binding)
at System.Windows.Forms.Binding.SetBindableComponent(IBindableComponent value)
at System.Windows.Forms.ControlBindingsCollection.AddCore(Binding dataBinding)
at System.Windows.Forms.ControlBindingsCollection.Add(String propertyName, Object dataSource, String dataMember, Boolean formattingEnabled, DataSourceUpdateMode updateMode, Object nullValue, String formatString, IFormatProvider formatInfo)
at System.Windows.Forms.ControlBindingsCollection.Add(String propertyName, Object dataSource, String dataMember)
at JAMSWin.DtlJob..ctor(JobList jobList, Int32 initialPosition)
at JAMSWin.ViewJobs.SList_ItemActivate(Object sender, EventArgs e)
at MVPSI.Forms.SList.OnItemActivate(EventArgs e)
at MVPSI.Forms.SList.OnDoubleClick(EventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Assembly Information:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
JAMSWin, Version=4.2.310.0, Culture=neutral, PublicKeyToken=7da961def3057cf2
System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
JAMSShr, Version=4.2.28.0, Culture=neutral, PublicKeyToken=7da961def3057cf2
System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
GenuineChannels, Version=2.5.2.36, Culture=neutral, PublicKeyToken=7da961def3057cf2
System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Syncfusion.Edit, Version=1.6.1.0, Culture=neutral, PublicKeyToken=7da961def3057cf2
Accessibility, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a



Answer this question

Browsable attribute breaking change?

  • mazen44

    Hello John,

    have you found a workaround or a fix for that problem. Because i got the same ErrorMessage. Only way it works for my in this time is to remove the Browsable(false).

    Hope you have found another workaround

    Thanks Peter


  • Pierre-Yves Troel

    If I remove the Browsable attribute databinding works.


  • SqlShaun

    I haven't found a workaround other than removing the Browsable(false).


  • JimIT

    The browsable attribute doesnt have anything to do with databinding, in 1.1 or 2.0. Are you sure that its the Browsable attribute that is doing this Have you tried removing the Browsable(false) from the property and seeing if that changes anything

  • Browsable attribute breaking change?