Steve Tousi

I am migrating my projects to v1.5 and have a DataContract class which contains a two-dimensional array of doubles. See below:


public class WifiRequest


private Double[ , ] _graph;


public Double[ , ] Graph


get { return _graph; }

set { _graph = value; }


I get the error message:

System.InvalidCastException was unhandled by user code

Message="Unable to cast object of type 'Microsoft.Dss.Core.Utilities.DssTwoDimArray`1[System.Double]' to type 'System.Double[,]'."



at steve.sensors.tests.Proxy.WifiRequest.Clone() in c:\Microsoft Robotics Studio (1.5)\samples\steve\sensors\tests\WifiTestWorld\Proxy\steve.sensors.tests.Proxy.WifiTestWorldTypes.cs:line 546

at Microsoft.Dss.Services.Serializer.DataCache.CloneOrTransformToProxy(Object Source)

at Microsoft.Dss.Services.Forwarders.Dssp.DsspOperationOutboundForwarder.Consume(IPortElement element)

at Microsoft.Ccr.Core.Port`1.PostInternalFast(T item)

at Microsoft.Ccr.Core.Port`1.Post(T item)

at Microsoft.Dss.Services.SubscriptionManager.SubscriptionManager.ForwardIndividualNotification(DsspOperation notification, SubscriptionRecord record)

at Microsoft.Dss.Services.SubscriptionManager.SubscriptionManager.ForwardNotification(Submit req)

at Microsoft.Ccr.Core.Task`1.Execute()

at Microsoft.Ccr.Core.TaskExecutionWorker.ExecuteTaskHelper(ITask currentTask)

at Microsoft.Ccr.Core.TaskExecutionWorker.ExecuteTask(ITask& currentTask, DispatcherQueue p)

at Microsoft.Ccr.Core.TaskExecutionWorker.ExecutionLoop()

If anyone has advice on how to fix the error or include 2-d arrays in data types that get sent over ports, Id greatly appreciate it.

Thanks in advance,


Re: Microsoft Robotics - Community 2d array as data member

George Chrysanthakopoulos

there was just a thread on this in the Dss subforum but it stopped reproducing so we never figured out why it happened. You can use directly the DssTwoDimArray<> type as a data member, and access your array using the Array field (as a workaround)


Re: Microsoft Robotics - Community 2d array as data member

Steve Tousi

Thanks George! That worked Great!