1
Vote

Setting value by index works for scalars and 1D variables only

description

The folowing program

using System;
using Microsoft.Research.Science.Data;
using System.Diagnostics;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var ds = DataSet.Open("");
var v = ds.AddVariable<double>("test", new double[,] { { 11, 12 }, { 21, 22 } }, "x", "y");
Debug.Assert(!ds.HasChanges);
v[0, 0] = Math.PI;
}
}
}

Raises exception

System.ArgumentException was unhandled
Message=Array has wrong rank.
Source=Microsoft.Research.Science.Data
StackTrace:
   at Microsoft.Research.Science.Data.Variable.PutData(Int32[] origin, Array data)
   at Microsoft.Research.Science.Data.Variable`1.set_Item(Int32[] indices, DataType value)
   at ConsoleApplication1.Program.Main(String[] args) in C:\Users\vassilyl\AppData\Local\Temporary Projects\ConsoleApplication1\Program.cs:line 14
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Expected: No exception, data value changed.

comments