title: Getting Error: System.Exception: Could not get device interface detail. Error code: 122 when using HID.Net and USB.Net
body: <p>I have a Console App (.Net Core) project that is using the <a href="https://github.com/MelbourneDeveloper/Device.Net" rel="nofollow noreferrer">Hid.Net</a> Library, where the end goal is to connect with my HID game controllers and read data from it, but as a starting point in understanding the library, I had written code to enumerate connected devices of the game controller I wanted to connect to. The code I had written was following the <a href="https://github.com/MelbourneDeveloper/Device.Net/wiki/Enumerating-Connected-Devices" rel="nofollow noreferrer">documentation</a> from the library. But when I ran the project, I got the error:</p>
  
  <p>System.Exception: Could not get device interface detail. Error code: 122</p>
  
  <p>This is the code that I had written:</p>
  
  <pre><code>using System;
  using System.Threading.Tasks;
  using Device.Net;
  using Hid.Net.Windows;
  using Usb.Net.Windows;
  
  namespace IOLibrary
  {
      class Program
      {
          static void Main(string[] args)
          {
              CheckforDevices();
  
              Console.ReadLine();
          }
  
          static async Task CheckforDevices()
          {
              try
              {
                  WindowsHidDeviceFactory.Register();
                  WindowsUsbDeviceFactory.Register();
  
                  var devices = await DeviceManager.Current.GetConnectedDeviceDefinitions(0x0079, 0x0006);
                  foreach(var device in devices)
                  {
                      Console.WriteLine(device.DeviceId);
                  }
  
              }
              catch(Exception e)
              {
                  Console.WriteLine(e.ToString());
              }
          }
      }
  }
  </code></pre>
  
  <p>I don't understand what I am doing wrong, so any explanation or insight is greatly appreciated. </p>