Hi,<br><br>I&#39;ve been using IronPython for a few months now, and I&#39;m really enjoying it. Thanks for all the hard work that&#39;s gone into it.<br><br>I recently ran across an issue, and I wondered if anyone else has seen it. I think it&#39;s probably a bug, but I couldn&#39;t find a bug report, either.
<br><br>Basically, if there is a CLR class that takes an array as its only constructor argument, IronPython always tries to call it using params. For example, if I compile this to ParamCall.dll:<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
<span style="font-family: courier new,monospace;">// ParamCall.cs</span><br><span style="font-family: courier new,monospace;"></span><br><span style="font-family: courier new,monospace;">using System;</span><br><span style="font-family: courier new,monospace;">
</span><br><span style="font-family: courier new,monospace;">namespace ParamCall</span><br><span style="font-family: courier new,monospace;">{</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; public class ParamCall
</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; {</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private string[] args;</span><br><span style="font-family: courier new,monospace;"></span>
<br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public ParamCall(string[] args)</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><br><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.args = args;</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><br><span style="font-family: courier new,monospace;"></span><br><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public string Joined()</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return String.Join(&quot;,&quot;, args);</span><br>
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; }</span><br><span style="font-family: courier new,monospace;">}</span><br><span style="font-family: courier new,monospace;">
</span></blockquote><span style="font-family: courier new,monospace;"><br></span>And I call it using this script:<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
<span style="font-family: courier new,monospace;"># paramcall.py</span><br><span style="font-family: courier new,monospace;"></span><br><span style="font-family: courier new,monospace;">import clr</span><br><span style="font-family: courier new,monospace;">
clr.AddReference(&#39;ParamCall&#39;)</span><br><span style="font-family: courier new,monospace;"></span><br><span style="font-family: courier new,monospace;">from ParamCall import ParamCall</span><br><span style="font-family: courier new,monospace;">
from System import Array</span><br><span style="font-family: courier new,monospace;"></span><br><span style="font-family: courier new,monospace;">args = Array[str]( [&#39;a&#39;, &#39;b&#39;, &#39;c&#39;] )</span><br><span style="font-family: courier new,monospace;">
print &#39;args =&#39;, args</span><br><span style="font-family: courier new,monospace;"></span><br><span style="font-family: courier new,monospace;">print &#39;creating ParamCall object:&#39;</span><br><span style="font-family: courier new,monospace;">
pc = ParamCall(args)</span><br><span style="font-family: courier new,monospace;">print &#39;pc.Joined() =&gt;&#39;, pc.Joined()</span><br><span style="font-family: courier new,monospace;"></span><br><span style="font-family: courier new,monospace;">
print</span><br><span style="font-family: courier new,monospace;"></span></blockquote><span style="font-family: courier new,monospace;"><br></span>I get these results.<br><br><span style="font-family: courier new,monospace;">
</span><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"><span style="font-family: courier new,monospace;">C:\home\eric\src\ase\Lse.Net&gt;IronPython\ipy 
paramcall.py</span><br><span style="font-family: courier new,monospace;">args = System.String[](&#39;a&#39;, &#39;b&#39;, &#39;c&#39;)</span><br><span style="font-family: courier new,monospace;">creating ParamCall object:
</span><br><span style="font-family: courier new,monospace;">Traceback (most recent call last):</span><br><span style="font-family: courier new,monospace;">&nbsp; File C:\home\eric\src\ase\Lse.Net\paramcall.py, line 7, in Initialize
</span><br><span style="font-family: courier new,monospace;">&nbsp; File , line 0, in __import__##4</span><br><span style="font-family: courier new,monospace;">&nbsp; File C:\home\eric\src\ase\Lse.Net\ParamCall.py, line 15, in Initialize
</span><br><span style="font-family: courier new,monospace;">&nbsp; File , line 0, in NonDefaultNew##54</span><br><span style="font-family: courier new,monospace;">TypeError: ParamCall() takes exactly 1 argument (3 given)</span>
<br><span style="font-family: courier new,monospace;"></span></blockquote><span style="font-family: courier new,monospace;"><br></span>I have also tried wrapping the arguments in a tuple and calling it like ParamCall( *(args,) ), but the results are the same.
<br><br> If anyone has any suggestions for work-arounds or clues as to what I&#39;m doing wrong, I&#39;d be glad to hear them.<br><br>Thanks,<br><br>-- <br>Eric Rochester<br><br>