System.Reflection.AmbiguousMatchException: Ambiguous match f

Posted by oedev on 07-Sep-2018 03:56

Progress 10.2B08

3rd party library: http://restsharp.org/

Using a version of the library built for .NET 3.5 (https://github.com/bnoffer/owncloud-sharp/files/527037/RestSharp.zip)

---

When making a simple request using the library, I'm receiving the following error;

"System.Reflection.AmbiguousMatchException: Ambiguous match found."

This occurs when using any of the execute methods provided on the RestClient. 

Stacktrace of error;

NET StackTrace:
--> at System.DefaultBinder.SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers)
at Progress.ClrBridge.UnknownBinder.SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers)
at System.RuntimeType.GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type[] types, ParameterModifier[] modifiers)
at System.Type.GetMethod(String name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
at Progress.ClrBridge.ClrApi.InvokeMethod(Object instance, String typeName, String methodName, Type[] types, Object[] args)
at Progress.ClrBridge.BrgClrFromPro.invokeMethod(BrgClrFromPro* , Int32 , SByte* , SByte* , Int32 , prmhdr* , Int32* , Int32 )

Any pointers to what the cause may be? Using this library as need to do a mult-form submission with form fields and a file, and using the standard .NET HTTP client is quite onerous.

Thanks.

All Replies

Posted by oedev on 07-Sep-2018 04:10

Example code to re-produce issue;

USING RestSharp.*.

def variable request as RestSharp.RestRequest.
def variable client as RestSharp.RestClient.
def variable response as RestSharp.IRestResponse.

client = new RestSharp.RestClient("https://reqres.in/api/").
request = new RestSharp.RestRequest("users", RestSharp.Method:GET).

response = client:Execute(request).

Posted by oedev on 07-Sep-2018 05:15

I *think* the reason for the error is down to multiple methods in the .NET class with the same name and input parameters, but one of the methods allows an option type to be specified;

Using an alternate method such as DownloadData works.

This thread is closed