You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicclassPerson{publicstringName{get;set;}}classProgram{staticvoidMain(string[]args){varlist=newList<Person>();
list.Add(new Person {Name="Joe"});
list.Add(new Person {Name="Mary"});varrequest=new RestRequest("url");
request.AddObject(list);new RestClient("http://localhost:1234").Execute(request);}}
Expected Behavior
request.AddObject works without exception, just like request.AddObject(list.ToArray());
My suggestion is check if incoming object implements IEnumerable and start there with deciding how to serialize
Actual Behavior
request.AddObject(list); //crashes
Steps to Reproduce the Problem
paste code
run
see exception
Specifications
Version:
Platform:
Subsystem:
StackTrace
System.Reflection.TargetParameterCountException occurred
HResult=0x8002000E
Message=Parameter count mismatch.
Source=mscorlib
StackTrace:
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
at RestSharp.RestRequest.AddObject(Object obj, String[] includedProperties)
at RestSharp.RestRequest.AddObject(Object obj)
at ConsoleApp1.Program.Main(String[] args) in e:\temp\ConsoleApp1\Program.cs:line 21
The text was updated successfully, but these errors were encountered:
Sample code:
Expected Behavior
request.AddObject works without exception, just like request.AddObject(list.ToArray());
My suggestion is check if incoming object implements IEnumerable and start there with deciding how to serialize
Actual Behavior
request.AddObject(list); //crashes
Steps to Reproduce the Problem
Specifications
StackTrace
The text was updated successfully, but these errors were encountered: