[Mono-bugs] [Bug 500005] using DrawString results in an "No non-narrowing (except object)" error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri May 1 08:14:21 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=500005

User andyhume32 at yahoo.co.uk added comment
http://bugzilla.novell.com/show_bug.cgi?id=500005#c2


Andy Hume <andyhume32 at yahoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |andyhume32 at yahoo.co.uk
         Resolution|DUPLICATE                   |




--- Comment #2 from Andy Hume <andyhume32 at yahoo.co.uk>  2009-05-01 06:14:19 MDT ---
There's a bug in the VBNC compiler with finding and using conversion operators.
 As DrawString takes a RectangleF, the workaround is to do "New RectangleF"
rather that "New Rectangle".

----
Now the bugs.  Given:

public void DrawString(string s, Font font, Brush brush, RectangleF
layoutRectangle)

public struct Rectangle {
..
}

public struct RectangleF {
   public static implicit operator RectangleF(Rectangle r);
..
}

And the call above.  Then:

1) VBNC should use the conversion operator implicitly.

2) Or explicitly with CType; should succeed but fails with:
[[
Visual Basic.Net Compiler version 0.0.0.5914 (Mono 2.4 - r)
Copyright (C) 2004-2008 Rolf Bjarne Kvinge. All rights reserved.

D:\Temp\weeee.vb (39,10) : Error VBNC99999: There was an exception during code
generation.
D:\Temp\weeee.vb (38,26) : Error VBNC99999: There was an exception during code
generation.
<MyGenerator> (1,1) : Error VBNC99999: Unexpected error: There has been an
internal error in the compiler: Operator CType is not defined for types
'System.Drawing.Rectangle' and 'System.Drawing.RectangleF'
  at vbnc.CTypeExpression.GenerateCTypeCode (vbnc.EmitInfo Info, System.Type
DestinationType, System.Type SourceType) [0x00000] 
  at vbnc.CTypeExpression.GenerateCodeInternal (vbnc.EmitInfo Info) [0x00000] 
  at vbnc.Expression.GenerateCode (vbnc.EmitInfo Info) [0x00000] 
Compilation took 00:00:01.9687500
]]

3) With DirectCast it should report error BC30311, but fails with:
[[
..
D:\Temp\weeee.vb (47,15) : Error VBNC99997: You've encountered something in the
compiler which is not implemented. Please file a bug (see instructions here:
http://mono-project.com/Bugs)
]]

-- 
Configure bugmail: http://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