System.TypeLoadException not load type 'System.Diagnostics.Eventing.EventDescriptor'

314 views Asked by At

Hi First time post currently working with a xbox kinect (C# in VS) and trying to create a start and stop feed when clicking the start button i recive this error.

(If there is any more information you require please do not hesitate to ask)

System.TypeLoadException: 'Could not load type 'System.Diagnostics.Eventing.EventDescriptor' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.'

inside the Program.cs

this is the current listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

using Microsoft.Kinect;
using Microsoft.Kinect.Toolkit;
using Microsoft.Kinect.Toolkit.Controls;
using Microsoft.Kinect.Toolkit.Interaction;

namespace Xbox_Kinect_Fall_Detection
{
    static class Program
    {
        /// <summary>
        ///  The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmKinect());
        }
    }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using Microsoft.Kinect;
using Microsoft.Kinect.Toolkit;
using Microsoft.Kinect.Toolkit.Controls;
using Microsoft.Kinect.Toolkit.Interaction;

namespace Xbox_Kinect_Fall_Detection
{
    public partial class FrmKinect : Form
    {
        private KinectSensor kSensor;
        public FrmKinect()
        {
            InitializeComponent();
        }

        private void BtnFeed_Click(object sender, EventArgs e)
        {
            if(btnFeed.Text == "Start / Stop")
            {
                if(KinectSensor.KinectSensors.Count > 0)
                {
                    kSensor = KinectSensor.KinectSensors[0];
                    KinectSensor.KinectSensors.StatusChanged += KinectSensors_StatusChanged;
                }

                kSensor.Start();
                this.lblConnectionid.Text = kSensor.DeviceConnectionId;
            }
            else 
            { 
                if(kSensor != null && kSensor.IsRunning)
                {
                    kSensor.Stop();
                    this.btnFeed.Text = "Start / Stop";
                    this.pbFeed.Image = null;
                }
            }
        }
     
        
        void KinectSensors_StatusChanged(object sender, StatusChangedEventArgs e)
        {
            this.lblStatus.Text = kSensor.Status.ToString();
        }
    }


}

Currently i have located that this issue is inisde Program.cs and only oocurs when clicking start on the feed.

0

There are 0 answers