I was having issues with this code:
using System;using GoBus;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using NetduinoGo;using System.Threading;using SecretLabs.NETMF.Hardware.NetduinoGo;namespace MFConsoleApplication1{ public class Program { //notice the static ShieldBase static ShieldBase shieldBase = new ShieldBase(GoSockets.Socket5); public static void Main() { var ledPort = new OutputPort(shieldBase.Pins.GPIO_PIN_D4, false); while (true) { ledPort.Write(!ledPort.Read()); System.Threading.Thread.Sleep(250); } } }}
It throws this:
An unhandled exception of type 'System.Exception' occurred in GoBusSerialTransport.dll
but this code works fine:
using System;using GoBus;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;using NetduinoGo;using System.Threading;using SecretLabs.NETMF.Hardware.NetduinoGo;namespace MFConsoleApplication1{ public class Program { public static void Main() { ShieldBase shieldBase = new ShieldBase(GoSockets.Socket5); var ledPort = new Microsoft.SPOT.Hardware.OutputPort(shieldBase.Pins.GPIO_PIN_D4, false); while (true) { ledPort.Write(!ledPort.Read()); System.Threading.Thread.Sleep(250); } } }}
Why can't I have a static instance of a go!bus module?
A similar exception happened when I tried to use the button (making it static vs not static) except the exception occurred in a different dll (whichever one contains the button)