Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime Error #422

Open
RinayShah opened this issue Jul 23, 2018 · 1 comment
Open

Runtime Error #422

RinayShah opened this issue Jul 23, 2018 · 1 comment

Comments

@RinayShah
Copy link

RinayShah commented Jul 23, 2018

When I run my code:

namespace Arges.KinectRemote.TestBodyConsole
{
    static class Program
    {
        private static string _exchange;
        private static string _ipAddress;
        private static string _bodyBindingKey;

        private static void ReadConfigSettings()
        {
            _exchange = ConfigurationManager.AppSettings["exchange"].Trim();
            _ipAddress = ConfigurationManager.AppSettings["ipAddress"].Trim();
            _bodyBindingKey = ConfigurationManager.AppSettings["bodyBindingKey"].Trim();
            if(string.IsNullOrEmpty(_exchange))
            {
                throw new ArgumentException("Exchange is not specified in the app.config.");
            }
            if (string.IsNullOrEmpty(_ipAddress))
            {
                Console.WriteLine("IP Address not specified. Connecting to local host.");
                _ipAddress = "127.0.0.1";
            }
            if (string.IsNullOrEmpty(_bodyBindingKey))
            {
                Console.WriteLine("Body binding key not specified. Binding to all remotes for body information.");
                _bodyBindingKey = "*.body";
            }
            Console.WriteLine("Exchange is: {0}", _exchange);
            Console.WriteLine("IP address is: {0}", _ipAddress);
            Console.WriteLine("Listening for bodies to: {0}", _bodyBindingKey);
        }

        private static void Main()
        {
            ReadConfigSettings();
            
            try
            {
                using (var receiver = new KinectBagReceiver<KinectBody>(_ipAddress, _exchange, _bodyBindingKey))
                {
                    while (true)
                    {
#if NoWait
                        // Non-blocking, will return null if there isn't any data available
                        var kinectData = receiver.DequeueNoWait();
                        if (kinectData != null)
                        {
                            LogKinectData(kinectData);
                        }
                        System.Threading.Thread.Sleep(1);
#else
                        // Blocking call
                        var kinectData = receiver.Dequeue();
                        LogKinectData(kinectData);
#endif
                    }
                }
            }
            catch(Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.Message);
                Console.ResetColor();
                Console.WriteLine(ex.StackTrace);
                Console.ReadLine();
            }
        }

        static void LogKinectData(KinectBag<KinectBody> bundle)
        {
            Console.WriteLine("{0} New bundle from {1} ", DateTime.UtcNow.ToFileTimeUtc(), bundle.SensorId);
            if (bundle.Items != null)
            {
                Console.WriteLine("Bundle contains {0} bodies", bundle.Items.Count);
                foreach (var body in bundle.Items)
                {
                    Console.WriteLine("- Body {0}", body);
                    Console.WriteLine("- Hand States. Left {0} (Conf: {1}) Right {2} (Conf: {3})", body.HandLeftState, body.HandLeftConfidence, body.HandRightState, body.HandRightConfidence);
                    if (body.FloatData.Keys.Count > 0)
                     {
                        Console.WriteLine("- Custom Data");
                        foreach (var kv in body.FloatData)
                        {
                            Console.WriteLine("-- {0}: {1}", kv.Key, kv.Value);
                        }
                    }
                    Console.WriteLine("- Joints");
                    foreach (var joint in body.Joints)
                    {
                        Console.WriteLine("  - {0}", joint);
                    }

                }
            }
            else
            {
                Console.WriteLine("Empty bundle.");
            }
        }
    }
}


I get this error:

otoo1

I looked at other issues where they dicussed about installing older Protobuf Packages but when I try to do that I get an error saying

Severity Code Description Project File Line Suppression State
Error Could not install package 'protobuf-net 2.2.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v3.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. 0

@mgravell
Copy link
Member

mgravell commented Jul 23, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants