diff --git a/Changelog.md b/Changelog.md index d0f82533c..8b52a6776 100644 --- a/Changelog.md +++ b/Changelog.md @@ -118,4 +118,5 @@ Be aware that code written for 1.9 will not work out of the box because DotSpati - Legend drag line so it doesn't look as if you can move a layer in between categories (#1008) - Legend selection to be able to select features of a category (#1008) - Some errors in SetSelectable plugin (#1008) +- Crash when attempting to use a serial GPS device on Mono - Clear the selection inside FeatureLayer.RemoveSelectedFeatures so the removed features are no longer contained when IFeatureSet.FeatureRemoved is raised \ No newline at end of file diff --git a/Contributors b/Contributors index f9e6c98a3..d85f95214 100644 --- a/Contributors +++ b/Contributors @@ -48,4 +48,5 @@ Tomaso Tonelli Teva Veluppillai Peder Wikstrom Chris Wilson -Ping Yang \ No newline at end of file +Ping Yang +Trent Muhr \ No newline at end of file diff --git a/Source/DotSpatial.Positioning.Compact/GPS/Devices/SerialPort.cs b/Source/DotSpatial.Positioning.Compact/GPS/Devices/SerialPort.cs index db309218b..00253940c 100644 --- a/Source/DotSpatial.Positioning.Compact/GPS/Devices/SerialPort.cs +++ b/Source/DotSpatial.Positioning.Compact/GPS/Devices/SerialPort.cs @@ -30,6 +30,7 @@ internal class SerialPort #endif private StreamReader _Reader; + private bool onMono = Type.GetType("Mono.Runtime") != null; #region Constructors @@ -59,7 +60,8 @@ public SerialPort(string portName, int baudRate, Parity parity, int dataBits, St NewLine = "\r\n"; WriteBufferSize = NmeaReader.IdealNmeaBufferSize; ReadBufferSize = NmeaReader.IdealNmeaBufferSize; - ReceivedBytesThreshold = 65535; // We don't need this event, so max out the threshold + if (!onMono) // ReceivedBytesThreshold is not implemented on mono, thus throwing an exception. + ReceivedBytesThreshold = 65535; // We don't need this event, so max out the threshold Encoding = Encoding.ASCII; } #endif diff --git a/Source/DotSpatial.Positioning/SerialPort.cs b/Source/DotSpatial.Positioning/SerialPort.cs index 3485b0d6b..39d1287b9 100644 --- a/Source/DotSpatial.Positioning/SerialPort.cs +++ b/Source/DotSpatial.Positioning/SerialPort.cs @@ -48,6 +48,7 @@ internal class SerialPort /// /// private StreamReader _reader; + private bool onMono = Type.GetType("Mono.Runtime") != null; #region Constructors @@ -97,7 +98,8 @@ public SerialPort(string portName, int baudRate, Parity parity, int dataBits, St NewLine = "\r\n"; WriteBufferSize = NmeaReader.IDEAL_NMEA_BUFFER_SIZE; ReadBufferSize = NmeaReader.IDEAL_NMEA_BUFFER_SIZE; - ReceivedBytesThreshold = 65535; // We don't need this event, so max out the threshold + if (!onMono) // ReceivedBytesThreshold is not implemented on mono, thus throwing an exception. + ReceivedBytesThreshold = 65535; // We don't need this event, so max out the threshold Encoding = Encoding.ASCII; }