I am having a weird problem with my C# code and binding. The code works fine when I run it as the .exe or when I run it on another machine running windows 7 64 bit in debug mode. This problem only occurs when I am debugging on a particular machine. An exception of type 'System.ArgumentNullException' occurred in System.dll but was not handled in user code. I cannot figure out what the problem is. I have commented some code that I added which gets rid of the problem but I cannot figure out why it only happens on one machine.
I found an interesting post regarding a bug in .net 4.5 Combobox SelectedItem DataBinding NullReference Exception
Here is the code that causes the exception and is bound to a data
private ObservableCollection<DataPoint> _pin1 { get; set; }
public IList<DataPoint> Pin_1 { get; set; }
public ObservableCollection<DataPoint> Pin1
{
get
{
//if(Pin_1 != null)
return _pin1 = new ObservableCollection<DataPoint>(Pin_1);
//return _pin1 = null;
}
set
{
if (_pin1 != value)
{
_pin1 = value;
OnPropertyChanged("Pin1");
}
}
}
I have looked at the following similar problems and feel that these might be what I am experiencing.
Two-way binding with Windows Forms ComboBox throws NullReferenceException when changed