まさにこれというサイトがありました。
http://www2.koyahatataku.com/blog/2017/09/26/c%e3%81%aewpdmtp%e6%93%8d%e4%bd%9c/
PortableDeviceManager.GetDevices にバグがあり正しく動かないということです。
この指摘はもう2年ぐらい前のものですが重大そうなバグなのに未だに直ってないのもおかしな話です。
何はともあれここで使われている修正版 DLL で希望の処理ができそうです。
※以下にDLLの修正方法がありましたので追記しておきます。
https://blogs.msdn.microsoft.com/dimeby8/2006/12/05/enumerating-wpd-devices-in-c/
PortableDeviceApiLib.dll をプロジェクトの参照から削除
再度システムオリジナルの PortableDeviceApiLibを参照に追加
obj\Release に Interop.PortableDeviceApiLib.dll ができるので
VSのコマンドプロンプトでこれを修正していきます。
最初の方に以下の様に書かれていますが
1.Disassemble the PortableDeviceApi interop using the command -
ildasm Interop.PortableDeviceApiLib.dll /out:pdapi.il
2.Open the IL in Notepad and search for the following string
instance void GetDevices([in][out] string& marshal( lpwstr) pPnPDeviceIDs,
3.Replace all instances of the string above with the following string
instance void GetDevices([in][out] string[] marshal([]) pPnPDeviceIDs,
4.Save the IL and reassemble the interop using the command -
ilasm pdapi.il /dll /output=Interop.PortableDeviceApiLib.dll
「3」の所をこのページの下の方のコメントに書かれている以下の様にします。
instance void GetDevices([in][out] string[] marshal( lpwstr[]) pPnPDeviceIDs,
C#の呼び出し側は同じページに書かれている通りでOKでした。
uint cDevices = 1;
devMgr.GetDevices(null, ref cDevices);
string[] deviceIDs = new string[cDevices];
devMgr.GetDevices(deviceIDs, ref cDevices);
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。