The motors start running, but the method never returns, so you end up blocked in that call.
Is that the expected behavior? I would have thought that the idea of the method was to left the motors running at the given speed and return, to do for example, something like this:
var sensor = new EV3IRSensor(SensorPort.In4);
Vehicle vehicle = new Vehicle (MotorPort.OutB, MotorPort.OutC);
vehicle.ReverseLeft = false;
vehicle.ReverseRight = false;
if (sensor.ReadDistance () < 40)
I tried that solution, but now I get blocked on the vehicle.Brake() method.
I also tried to stop the thread with the Forward method, before calling the vehicle.Brake() method, but then I get a System.InvalidOperationException on the thread with the vehicle.Forward call.
I will have a look at it tomorrow and upload a new version as soon as I have a fix. In the meantime use the motor sync class which is the class that the vehicle class is based on – or you could just wait a day or two…