berkesokhan / rubydotnetcompiler

Automatically exported from code.google.com/p/rubydotnetcompiler
1 stars 0 forks source link

CLR interop does not convert Ruby.Float to System.Single #47

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Test case:

require 'mscorlib.dll'
require 'System.dll'
require 'System.Drawing.dll'

System::Drawing::Font.new('Monotype Corsiva', 11.25)

The CLR constructor has the type Font(String, Single), which should be
compatible with the values above, but instead raises the following exception:

Unhandled Exception: Ruby.Runtime.RubyException: couldn't match arguments
to (System.Drawing.Font:.ctor)
   at Ruby.Interop.MultiMethod.Calln(Class last_class, Object recv, Frame
caller, ArgList args)
   at Ruby.Runtime.MethodBody.Call2(Class last_class, Object recv, Frame
caller, Proc block, Object p1, Object p2)
   at Ruby.Runtime.Eval.CallPublic2(Object recv, Frame caller, String
methodId, Proc block, Object arg1, Object arg2)
   at _Internal.SourceFile_interopbug.Load(Object recv, Frame caller) in
interopbug.rb:line 5
   at Main(String[] args)

The problem seems to be that float is not a subtype of Single in the CTS,
which prevents our interop from matching the constructor arguments. This
causes code produced by Visual Forms Designer to raise an exception: try
changing the font for any control in a Ruby Windows Forms application.

Original issue reported on code.google.com by meaningi...@gmail.com on 18 Oct 2007 at 4:35