2

When using sensors such as barometer,compas etc. in Xamarin.Forms you cannot check if the sensor is available but have to try starting it and then catch the exception, if it is not there, such as here.

try
{
  Barometer.Start(SensorSpeed.Game);
}      
catch
{
  //failed
}

The issue is that this happens every single time, I debug on a device without these sensors, and though I catch the exception, I break into it all the time.

The exception is

Xamarin.Essentials.FeatureNotSupportedException: 'Specified method is not supported.'

but when I, in exception settings, uncheck that one from "break when thrown", it still breaks on the exception. This derives from

System.NotSupportedException

which i then also uncheck, and still it breaks on it. The next levels up are System.SystemException System.Exception which I can uncheck to stop breaking when thrown, but I would rather do that, since then everything is effectively not breaking if caught, which I would still like.

JoeTaicoon
  • 1,383
  • 1
  • 12
  • 28

0 Answers0