Skip to content

2.31.0 C# Wrapper Crash #5369

@JBBee

Description

@JBBee

Required Info
Camera Model T265
Firmware Version 0.2.0.879
Operating System & Version Win10
Kernel Version (Linux Only)
Platform PC
SDK Version 2.31.0
Language C#
Segment AR

Issue Description

I'm experiencing a crash when using the C# wrapper in the development branch (2.31.0). The following code causes a crash:

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var ctx = new Context())
            {
                var devices = ctx.QueryDevices();
                if (devices.Count == 0) return;
                var dev = devices[0]; //T265

                using (var sensor = dev.QuerySensors().First(s => s.Is(Extension.PoseSensor)))
                using (var poseSensor = PoseSensor.FromSensor(sensor)) ;
            }
            System.Console.WriteLine("Done");
        }
    }
}

There appears to be one call to NativeMethods.rs2_create_sensor in SensorList but two calls to NativeMethods.rs2_delete_sensor each when the sensor and the poseSensor above are disposed.

Previously SensorList was generic so I could call QuerySensors() with the PoseSensor type directly but this was changed in #5170

How do I now get a PoseSensor from a device?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions