My code is like below:
// interfaces
[ServiceContract]
public interface IService1
{
[OperationContract]
MyResponse MyOperation(MyRequest request);
}
// services
public class Service1 : IService1
{
public MyResponse MyOperation(MyRequest request)
{
// do nothing.
throw new NotImplementedException();
}
}
// request & data contracts
[DataContract]
public class MyRequest
{
[DataMember(IsRequired = true)]
public IEnumerable<KeyValuePair<Enums, string>> Settings { get; set; }
}
[DataContract]
public class MyResponse
{
//...
}
[DataContract]
public enum Enums
{
[EnumMember] E1,
[EnumMember] E2
}
Error will occur when invoke "MyOperation".
Stack:
System.Reflection.TargetInvocationException was unhandled
HResult=-2146232828 Message=Exception has been thrown by the target of an invocation. Source=mscorlib StackTrace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme) at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme) at System.Windows.Forms.Control.InvokeMarshaledCallbacks() at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at Microsoft.Tools.TestClient.Program.Main(String[] args) InnerException: System.Reflection.TargetInvocationException HResult=-2146232828 Message=An exception occurred during the operation, making the result invalid. Check InnerException for exception details. Source=System StackTrace: at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at System.ComponentModel.RunWorkerCompletedEventArgs.get_Result() at Microsoft.Tools.TestClient.UI.MainForm.invokeServiceWorker_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e) at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e) at System.ComponentModel.BackgroundWorker.AsyncOperationCompleted(Object arg) InnerException: System.ArgumentNullException HResult=-2147467261 Message=Value cannot be null. Parameter name: elementType Source=mscorlib ParamName=elementType StackTrace: at System.Array.CreateInstance(Type elementType, Int32 length) at Microsoft.Tools.TestClient.Variables.ArrayVariable.CreateObject() at Microsoft.Tools.TestClient.Variables.CompositeVariable.CreateObject() at Microsoft.Tools.TestClient.ServiceExecutor.BuildParameters(Variable[] inputs) at Microsoft.Tools.TestClient.ServiceExecutor.PopulateInputParameters(String methodName, Variable[] inputs, Type contractType, MethodInfo& method, ParameterInfo[]& parameters, Object[]& parameterArray) at Microsoft.Tools.TestClient.ServiceExecutor.Execute(ServiceInvocationInputs inputValues) at Microsoft.Tools.TestClient.ServiceExecutor.Execute(ServiceInvocationInputs inputValues) at Microsoft.Tools.TestClient.ServiceExecutor.ExecuteInClientDomain(ServiceInvocationInputs inputs) at Microsoft.Tools.TestClient.UI.MainForm.invokeServiceWorker_DoWork(Object sender, DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument) InnerException: