This project is read-only.
1
Vote

Exception on launching/running Windows Media Player

description

I get following exception if I launch or keep Windows Media Player running. The exception occurs in ManagedUPnPTest project.


System.ArgumentOutOfRangeException was unhandled by user code
Message=InvalidArgument=Value of '15' is not valid for 'StateImageIndex'.
Parameter name: StateImageIndex
Source=System.Windows.Forms
ParamName=StateImageIndex
StackTrace:
   at System.Windows.Forms.TreeNode.set_StateImageIndex(Int32 value)
   at ManagedUPnPTest.ctlUPnPTreeBrowser.AddUPnPItem(TreeNodeCollection nodes, IUPnPTreeItem item) in D:\ManagedUPNP\ManagedUPnPTest\UPnPBrowser\ctlUPnPTreeBrowser.cs:line 191
   at ManagedUPnPTest.ctlUPnPTreeBrowser.GetDeviceNodeFor(Device device) in D:\ManagedUPNP\ManagedUPnPTest\UPnPBrowser\ctlUPnPTreeBrowser.cs:line 232
   at ManagedUPnPTest.ctlUPnPTreeBrowser.AddService(Service service) in D:\ManagedUPNP\ManagedUPnPTest\UPnPBrowser\ctlUPnPTreeBrowser.cs:line 262
   at ManagedUPnPTest.frmUPnPBrowser.dsServices_StatusNotifyAction(Object sender, StatusNotifyActionEventArgs a) in D:\ManagedUPNP\ManagedUPnPTest\frmUPnPBrowser.cs:line 116
   at ManagedUPnP.AutoEventedDiscoveryServices`1.OnStatusNotifyAction(StatusNotifyActionEventArgs e) in D:\ManagedUPNP\ManagedUPnP\AutoEventedDiscoveryServices.cs:line 267
   at ManagedUPnP.AutoEventedDiscoveryServices`1.StatusNotify(NotifyAction action, Object data) in D:\ManagedUPNP\ManagedUPnP\AutoEventedDiscoveryServices.cs:line 308
   at ManagedUPnP.AutoDiscoveryServices`1.AddAllFor(Services services) in D:\ManagedUPNP\ManagedUPnP\AutoDiscoveryServices.cs:line 412
   at ManagedUPnP.AutoDiscoveryServices`1.mdDiscovery_DeviceAdded(Object sender, DeviceAddedEventArgs e) in D:\ManagedUPNP\ManagedUPnP\AutoDiscoveryServices.cs:line 231
   at ManagedUPnP.Discovery.OnDeviceAdded(DeviceAddedEventArgs e) in D:\ManagedUPNP\ManagedUPnP\Discovery.cs:line 614
   at ManagedUPnP.Discovery.DeviceFinderCallbackWithInterface.UPNPLib.IUPnPDeviceFinderAddCallbackWithInterface.DeviceAddedWithInterface(Int32 findData, UPnPDevice device, Guid& guidInterface) in D:\ManagedUPNP\ManagedUPnP\Discovery.cs:line 219
InnerException:

comments

TheToid wrote Oct 4, 2014 at 4:21 PM

Interesting, thanks Magnum Pi, I will see if I can replicate.

TheToid wrote Oct 4, 2014 at 4:32 PM

Hey Magnum Pi,

Although I cannot replicate this directly I think I know what the cause was (I was setting the StateImageIndex) in the ctlUPnPTreeBrowser.AddUPnPItem method, when it gets above a certain value (apparently 14) and error occurs, so this problem should only occur when you have > 15 root devices displaying.

This is an easy fix, simply remove the StateImageIndex = ..... line in the AddUPnPItem method, can you confirm this is the problem?

Thanks.