0

I have extend IronPython with a function (no overloads, no generics, always returns string)

public string get_in_param(string key)

In my python script I have a call

step = int(myextension.get_in_param("step"))

There I - sometimes - get

Multiple targets could match: int(type, IList[Byte]), int(type, object), int(type, Extensible[float])

I read IronPython overload resolution on generic types about possible overloads, but my function always returns string, and int() is built in. Also, something like

step = int.Overloads[str](myextension.get_in_param("step"))

is not working (runtime error that Overloads is invalid).

"step" always contains the string representation of an integer. I am using IronPython 2.7.4 embedded into an application.

Why the sporadic error, and how to fix it?

Update:

More details on get_in_param:

Dictionary<string, string> dict = ...

public string get_in_param(string key)
{
    string res = null;
    dict.TryGetValue(key);
    return res;
}
Community
  • 1
  • 1
Andreas Reiff
  • 7,961
  • 10
  • 50
  • 104
  • Would you like to show us the complete implementation of `get_in_param` and how you pass it to your ip context? How do you create `myextension`? – BendEg Dec 15 '15 at 12:05
  • @BendEg Implementation of get_in_param is very straightforward, it gets a value from a Dictionary. I will add code in original post. The rest of the IronPython integration is in external code of the application, I just have source access to a plugin I am writing, my code registers an interface and implementation to provide this functionality that is then provided to IronPython outside of my code. – Andreas Reiff Dec 15 '15 at 12:25
  • 1
    Only for testing purpose, what does this do: `step = int(str(myextension.get_in_param("step")))` – BendEg Dec 15 '15 at 13:03
  • I did not have output of the actual value I was using.. now sometimes on print, it is empty. So I guess the value sometimes comes in as null and there is a timing problem outside of the code with clearing/filling the dictionary. IronPython then has the problem with the string being null with above message. – Andreas Reiff Dec 21 '15 at 13:28

0 Answers0