Home Forums Reply To:

Grant [Tobii]

Hi @dz32, after some consultation with the developers I can confirm there should be no difference in operability between operating system versions however there are no error handling or connection handshaking within the code snippet.

Accordingly, to make a proper sample you would have to wait for CoreSDK to inform you that a connection is established before trying to get states.

In your case I think what happens is that the connection isn’t established yet, that’s why it crashes (it shuts down because of an unhandled exception).

You have to listen to ConnectionStateChanged event or checking ConnectionState property before calling GetState to ensure that the connection is up and running.

For example:

Tobii.Interaction.Host host = new Host();


            ManualResetEvent signal = new ManualResetEvent(false);
            host.Context.ConnectionStateChanged += delegate(object sender, ConnectionStateChangedEventArgs args)
                if (args.State == ConnectionState.Connected)

            if (signal.WaitOne(100))
                var serialNumber = host.Context.GetState(StatePaths.EyeTrackingInfoSerialNumber).GetStateValueOrDefault<string>();
                Console.WriteLine(@"Connection not established!");

Please try it out and let us know how you get on!