SerialConnection error on macOS?

I am using the SerialConnection classes in a console helper application to access a Serial-to-USB device on Windows and macOS.
Basically connection looks like this:

Var seriald As serialdevice = SerialDevice.WithName(Me.PortName) If seriald <> Nil Then serial.Baud = Me.Baud serial.Bits = Me.Bits serial.CTS = Me.cts serial.DTR = Me.dtr serial.Parity = CType(Me.Parity, SerialConnection.Parities) serial.StopBit = CType(Me.StopBits, SerialConnection.StopBits) serial.XON = Me.xon serial.Device = seriald serial.Connect Return True End If
With an exception handler following, returning False.
Serial is an already created instance property of type SerialConnection, with its three events linked to class methods via Addhandler.

This works nicely on Windows, and I can read data in the DataAvailable Handler.
On macOS, the SerialConnection.Error handler fires twice before the connect method returns true (sic!).
Errorcode both times is 2, which most possibly means kBluetoothSDPErrorCodeInvalidServiceRecordHandle – at least this would correspond to the SerialConnection’s handle which is Nil (or rather -1) while its Device property is set correctly.
Any hints what I might be doing wrongly? Or a Xojo 2019r3 bug?

EDIT: An old project using the old serial class works.

[quote=471076:@Ulrich Bogun]Any hints what I might be doing wrongly?
Or a Xojo 2019r3 bug?
using the old serial class works.[/quote]

That means that 2019r3 is also bugged, and is unusable for me for my next project for Mac targets.

Please file a feedback bug.

I have not tried the new API2 serial stuff, why is it there when we have a perfectly working API 1 version?
19R3 with the existing serial class is working without any issue in all my projects.
I would be happy to hear comment from staff as to what the API2 serial class is designed to ‘update’ over the original.

There is a video from the last XDC where Xojo stuff explains the benefits of API 2.0 here:
https://www.youtube.com/watch?v=rPjbH4_sARs

Thanks all. I opened a private beta case as this is part of a customer’s project which I did not want to strip down.
I’ll keep you updated.

@Mark Carlton : From my point of view, SerialConnection follows the same structure other sockets have too under API 2.0: The same event names, the same error handling. Makes it easier to adapt code to different sockets.
Besides from that, I don’t have the feeling things changed under the hood. Except for, well, the inability to connect under macOS :wink:

Thanks.

As expected:
»Switched to a regular bug because the user indicates that it is reproducible in the current public release.«

I think I found the error to be located in SerialDevice.WithName which I was using. Does not create a valid Device on macOS.
SerialDevice.At does. With this limitation you could use 2019r3.

[quote=471356:@Ulrich Bogun]I think I found the error to be located in SerialDevice.WithName which I was using. Does not create a valid Device on macOS.
SerialDevice.At does. With this limitation you could use 2019r3.[/quote]

I historically made a bug report about this some time ago, in the old api. I guess they not even updated the newer API 2.0 code.

Getting a serial device by it’s name didn’t work but testing against it trough an indexed loop was the only way. I’ll try to find the bug report when on the computer.

(https://xojo.com/issue/52659)>]Case #52659

from 2018, verified and not fixed.

D’oh! So the class was modernized and the bug was ported instead of fixed.
Thank you, Derk! Added your ticket to my case.

[quote=471370:@Ulrich Bogun]D’oh! So the class was modernized and the bug was ported instead of fixed.
Thank you, Derk! Added your ticket to my case.[/quote]

bug re-ported (now that makes sense)

No thanks, i’d rather have xojo fixing it!

Well, officially your ticket was for API 1, mine is for API 2. New case. :smiley:

Both seems related, maybe even use the same broken code in an underlying layer below the API’s interfaces. Maybe one stone hits two rabbits.

I have the feeling that at least for API 2 this bug will soon be fixed