System::TypeLoadException when including C++/CLI interface with modopts
description
I'm trying to create a ruby class that implements a .NET interface that was written with C++/CLI and it throws a TypeLoadException when the interface includes a modopt.
The ruby class appears as such
class RubyVersion
include DotNet::ICppInterface
end
and the .NET IL method signature that includes the modopt appears as such
.method public hidebysig newslot abstract virtual instance void MethodName(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) slotNumber) cil managed
{
}
---
The full exception output is as follows
System::TypeLoadException: Signature of the body and declaration in a method implementation do not match. Type: 'IronRuby.Classes.Object$1'. Assembly: 'Snippets.scripting, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
mscorlib:0:in `_TermCreateClass'
mscorlib:0:in `CreateTypeNoLock'
mscorlib:0:in `CreateType'
c:\source\github\new_IR\ndp\fx\src\Core\Microsoft\Scripting\Actions\DynamicMetaObjectBinder.cs:84:in
`Bind'
c:\source\github\new_IR\ndp\fx\src\Core\Microsoft\Scripting\Actions\CallSiteBinder.cs:79:in
`BindDelegate'
WriteProgram_spec.rb:7
:0:in `instance_eval'
mspec.rb:65:in `protect'
context.rb:135:in `protect'
c:\source\github\new_IR\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtins\Enumerable.cs:53:in
`<TrueForItems>b__0'
:0:in `each'
c:\source\github\new_IR\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtins\Enumerable.cs:34:in
`Each'
c:\source\github\new_IR\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtins\Enumerable.cs:51:in
`TrueForItems'
:0:in `all?'
context.rb:133:in `protect'
context.rb:155:in `process'
:0:in `each'
context.rb:147:in `process'
mspec.rb:29:in `describe'
object.rb:10:in `describe'
WriteProgram_spec.rb:0
:0:in `load'
mspec.rb:55:in `files'
:0:in `instance_eval'
mspec.rb:65:in `protect'
mspec.rb:49:in `files'
:0:in `each'
mspec.rb:45:in `files'
mspec.rb:39:in `process'
mspec-run.rb:82:in `run'
script.rb:209:in `main'
mspec-run:0
---
The work around that I'm using is to create an abstract class in C# that implements the interface and inherit from the abstract class in Ruby, however it would be nice if IronRuby could work directly with the modopt interface.