EventLog.MessageWritten object reference not set to an instance of an object exception
vlima
✭
Hello, I would like to know why when I try to create an event handler for MessageWritten in some controllers I get the message object reference not set to an instance of an object exception. The source code in C# and the stacker trace are down below:
at ABB.Robotics.Controllers.EventLogDomain.EventLog.add_MessageWritten(EventHandler`1 value)
I have tried the code in controllers version 6.03.00 ; 6.05.00 ; 6.04.01 ; 6.06.00 and the interesting thing is that the version does not matter because I have tested in different controllers with the same version and sometimes I got the exception sometimes not. That makes me wonder what is causing that in some controllers I have the exception and others not...
scanner = new NetworkScanner();
scanner.Scan();
controllers = scanner.GetControllers();
ListViewItem item = null;
foreach (ControllerInfo controllerInfo in controllers)
{
// Add the controllers which are detected to the ListView
item = new ListViewItem(controllerInfo.IPAddress.ToString());
item.SubItems.Add(controllerInfo.Id);
item.SubItems.Add(controllerInfo.Availability.ToString());
item.SubItems.Add(controllerInfo.IsVirtual.ToString());
item.SubItems.Add(controllerInfo.SystemName);
item.SubItems.Add(controllerInfo.Version.ToString());
item.SubItems.Add(controllerInfo.ControllerName);
listView1.Items.Add(item);
item.Tag = controllerInfo;
// Create an object controller foreach robot in the network and activate the event handler to log the Event Messages.
Controller controller = new Controller(controllerInfo);
try
{
controller.EventLog.MessageWritten += (sender, e) => log_MessageWritten(sender, e, controller);
}
catch (Exception e)
{
}
Stacker trace:
at ABB.Robotics.Controllers.EventLogDomain.EventLog.GetCategory(Int32 id)
at ABB.Robotics.Controllers.EventLogDomain.EventLog.Subscribe(EventHandler`1 handler)Stacker trace:
at ABB.Robotics.Controllers.EventLogDomain.EventLog.GetCategory(Int32 id)
at ABB.Robotics.Controllers.EventLogDomain.EventLog.add_MessageWritten(EventHandler`1 value)
I have tried the code in controllers version 6.03.00 ; 6.05.00 ; 6.04.01 ; 6.06.00 and the interesting thing is that the version does not matter because I have tested in different controllers with the same version and sometimes I got the exception sometimes not. That makes me wonder what is causing that in some controllers I have the exception and others not...
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings