tags:

views:

94

answers:

2

I'm using the VirtualBox type library from C# as follows:

using System;
using System.Collections.Generic;
using System.Text;
using VirtualBox;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            IVirtualBox vbox = new VirtualBoxClass();

            IHost h = vbox.Host;

            Array a = h.USBDevices;           
        }
    }
}

The line Array a = h.USBDevices; causes a SafeArrayTypeMismatchException. Has anyone else had the same problem?

Thanks!

A: 

I had the same problem, but I can't figure out why. Other people are able to run it without this exception from the same source code!

A: 
var a = (IUSBDevice[])h.USBDevices
Perfect Gentleman