# Problem calling CLR method

**URL:** <https://www.ruby-forum.com/t/problem-calling-clr-method/157167>\
**Category:** IronRuby\
**Created:** [January 8, 2009, 2:24am UTC](https://www.ruby-forum.com/t/problem-calling-clr-method/157167 "2009-01-08T02:24:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex\_2k8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e9a140/32.png) [@alex\_2k8](https://www.ruby-forum.com/u/alex_2k8)\
**Post date:** [January 8, 2009, 2:24am UTC](https://www.ruby-forum.com/t/problem-calling-clr-method/157167/1 "2009-01-08T02:24:56Z")

</div>

Hello,

I can’t call the object’s method, thought it exists.

My ruby script:

* * *

# Let’s dump .Net methods

far.get\_type.get\_methods.each { |m| p m.name }

# Try to call ‘RegisterTool’ method

begin  
far.register\_tool  
rescue =\> err  
p err  
end

begin  
far.RegisterTool  
rescue =\> err  
p err  
end

* * *

I get such output:

* * *

…  
“RegisterFiler”  
“RegisterTool”  
…

#\<NoMethodError: undefined method `register_tool' for #<FarNet::Far:0x000005c>> #<NoMethodError: undefined method`RegisterTool’ for  
#FarNet::Far:0x000005c\>

* * *

Not sure if this matters, but ‘far’ variable is set by the script host  
scope.SetVariable(“far”, Far);

Thanks,

- Alex

---

<div class="post-metadata">

**Author:** ![alex\_2k8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e9a140/32.png) [@alex\_2k8](https://www.ruby-forum.com/u/alex_2k8)\
**Post date:** [January 8, 2009, 5:29pm UTC](https://www.ruby-forum.com/t/problem-calling-clr-method/157167/2 "2009-01-08T17:29:45Z")

</div>

Could you sent source code for FarNet class (RegisterTool method  
declaration)?

Tomas

---

<div class="post-metadata">

**Author:** ![alex\_2k8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e9a140/32.png) [@alex\_2k8](https://www.ruby-forum.com/u/alex_2k8)\
**Post date:** [January 8, 2009, 5:49pm UTC](https://www.ruby-forum.com/t/problem-calling-clr-method/157167/3 "2009-01-08T17:49:41Z")

</div>

> Could you sent source code for FarNet class (RegisterTool method  
> declaration)?

> **[GitHub - nightroman/FarNet: Far Manager framework for .NET modules and...](https://github.com/nightroman/farnet)**
>
> Far Manager framework for .NET modules and scripts in PowerShell, F#, JavaScript. - GitHub - nightroman/FarNet: Far Manager framework for .NET modules and scripts in PowerShell, F#, JavaScript.

> **[GitHub - nightroman/FarNet: Far Manager framework for .NET modules and...](https://github.com/nightroman/farnet)**
>
> Far Manager framework for .NET modules and scripts in PowerShell, F#, JavaScript. - GitHub - nightroman/FarNet: Far Manager framework for .NET modules and scripts in PowerShell, F#, JavaScript.

> **[GitHub - nightroman/FarNet: Far Manager framework for .NET modules and...](https://github.com/nightroman/farnet)**
>
> Far Manager framework for .NET modules and scripts in PowerShell, F#, JavaScript. - GitHub - nightroman/FarNet: Far Manager framework for .NET modules and scripts in PowerShell, F#, JavaScript.

Probably this is some how related to  
[Problem calling explicit interface methods - IronRuby - Ruby-Forum](http://www.ruby-forum.com/topic/175168) ?

---

<div class="post-metadata">

**Author:** ![alex\_2k8](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e9a140/32.png) [@alex\_2k8](https://www.ruby-forum.com/u/alex_2k8)\
**Post date:** [January 8, 2009, 6:06pm UTC](https://www.ruby-forum.com/t/problem-calling-clr-method/157167/4 "2009-01-08T18:06:39Z")

</div>

Btw, IronPython can call same method:

[http://farnet.googlecode.com/files/IronPythonFar.1.0.35.rar](http://farnet.googlecode.com/files/IronPythonFar.1.0.35.rar)  
IronPythonFar\Scripts\calc.py

* * *

far.RegisterTool(ipy, “IronPython calculator”, calc,  
FarManager.ToolOptions.F11Menus)

* * *
