[Mono-bugs] [Bug 338189] New: vbnc: Invalid IL from ("foo" & form.Size) etc

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Oct 31 12:07:34 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=338189

           Summary: vbnc: Invalid IL from ("foo" & form.Size) etc
           Product: Mono: Compilers
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Basic
        AssignedTo: rkvinge at novell.com
        ReportedBy: andyhume32 at yahoo.co.uk
         QAContact: mono-bugs at ximian.com
          Found By: ---


Code below compile successfully but produces bad IL
[[
Class FooBar
    Shared Sub Main()
        Dim f As New System.Windows.Forms.Form
        Console.WriteLine("xxx" + f.MinimumSize)
    End Sub
End Class
]]

It fails at runtime with mono error:
[[
Unhandled Exception: System.InvalidProgramException: Invalid IL code in
FooBar:Main (): IL_0011: call      0x0a000003
]]

The IL there contains:
[[
    IL_0006:  ldstr      "xxx"
    IL_000b:  ldloc.0
    IL_000c:  callvirt   instance valuetype [System.Drawing]System.Drawing.Size
[System.Windows.Forms]System.Windows.Forms.Form::get_MinimumSize()
    IL_0011:  call       valuetype [System.Drawing]System.Drawing.Size
[System.Drawing]System.Drawing.Size::op_Addition(valuetype
[System.Drawing]System.Drawing.Size,
                                                                               
                                        valuetype
[System.Drawing]System.Drawing.Size)
]]
So passing a String as the first argument to Size.op_Addition(Size, Size)...


Note, the -- only very slightly different -- code below correctly does not
compile:
[[
Class FooBar
    Shared Sub Main()
        Dim f As New System.Windows.Forms.Form
        Dim s1 As String = "xxx" + f.MinimumSize
        Console.WriteLine(s1)
    End Sub
End Class
]]
Failing with:
[[
A warning message should have been shown: 'narrowing operator'
Error : VBNC99999: Unexpected error: An error message should have been shown:
'Cannot convert from 'Size' to 'String''
  at vbnc.Helper.AddError (System.String Message) [0x00000]
  at vbnc.CTypeExpression.GenerateUserDefinedConversionCode (vbnc.EmitInfo
Info, vbnc.Expression Expression, System.Type DestinationType) [0x00000]
  at vbnc.CStrExpression.GenerateCode (vbnc.Expression Expression,
vbnc.EmitInfo Info) [0x00000]
]]


For both files MSFT vbc reports:
[[
vbnc_StringAddSizeProperty.vb(4) : error BC30518: Overload resolution failed
because no accessible '+' can be called with these arguments:
    'Public Shared Operator +(sz1 As System.Drawing.Size, sz2 As
System.Drawing.Size) As System.Drawing.Size': Value of type 'String' cannot be
converted to 'System.Drawing.Size'.

        Dim s1 As String = "xxx" + f.MinimumSize
                           ~~~~~~~~~~~~~~~~~~~~~
]]


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list