I am getting error for Object reference not set to an instance of an object. Throwing unhanded exception of type system.NullreferenceException occurred in xxx.exe.
Reference code: MainWindowViewModel.cs file
namespace iWave_Configuration_Tool.VM
{
public class MainWindowViewModel
{
public SynchronizationContext ViewContext;
public MainWindowViewModel()
{
UDS_ADDRESS = new UDSSourceAddress { };
DEVICE_INFO = new DeviceInfo { };
}
public UDSSourceAddress UDS_ADDRESS { get; set; }
public DeviceInfo DEVICE_INFO { get; set; }
}
}
port.cs file:
if (request.COMMAND_ID == CommandDefine.CommandID.GET_UDS_SOURCE_ADDRESS_REQ);
{
App.MAIN_WINDOW.DataContext = null;
App.MAIN_WINDOW.DataContext = App.ViewModel;
}