This project has moved and is read-only. For the latest updates, please go here.

Marshaler restriction: Excessively long string when accessing MMDevice.ID

Oct 17, 2010 at 2:37 PM


recently I discovered a flaw with NAudio. When I try to access the MMDevice.ID property an System.Runtime.InteropServices.MarshalDirectiveException is thrown (Message: "Marshaler restriction: Excessively long string."). After some googling I'm stuck because I cannot find a failure in the NAudio COM interop definition. May this be caused by a buggy sounddriver? However it fails with any audio endpoint installed in my system. Is there a possibility to work around accessing the devices ID? Basically I only want to access the devices ID to determine which one of the devices the deviceenumerator returned is actually my default device.

Your help is greatly appreciated

Stefan Hoffmeister

Mar 29, 2011 at 3:13 PM

Solution is here: