bugDotGNU Portable.NET - Bugs: bug #7265, compiler does not find error,...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #7265: compiler does not find error, runtime prints strange message

Submitter:  None
Submitted:  Thu 15 Jan 2004 05:54:49 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Thu 22 Jan 2004 05:21:12 AM UTC, comment #2: 

When I use the simple test case in your description,
I get the following error from cscc, which is what
I would expect:

click.cs:9: delegate expression is not compatible with `System.EventHandler'

I cannot build your EditWindow.cs example because it relies
upon classes that you did not supply (e.g. MForm).  Please
create a better test case and open a new bug if you are
still having problems.  But I am unable to replicate the
problem that was reported with the CVS version of pnet.

Rhys Weatherley <rweather>
Group administrator
Thu 15 Jan 2004 05:57:13 AM UTC, comment #1: 

Sorry, the file I attached got fat fingered when I copied it over.  The line with an error should be...

tbox.Click += new EventHandler(testHandler);

Anonymous
Thu 15 Jan 2004 05:54:49 AM UTC, original submission:  

If you add a handler for an event to a widget, and that handler has the wrong signature, the compiler blithely continues.

The eroneous code assigned to Click using += new EventHandler(handler),  but the signature of the handler is (object, PaintEventArgs)

When the program is run by ilrun, this message appears:  EditWindow::.ctor [2129] - call at verify_call.c:1089
Uncaught exception: System.Security.VerificationException: Could not verify the code
        at CqlJournal.EditWindow.Main(String[])

Code to produce this error:
TextBox tb = new TextBox();
tb.Click += new EventHandler(myHandler);
.
.
.
But, myHandler is not of type EventHandler.  The method that produced the error pasted above is:

private void myHandler(object obj, PaintEventArgs args)
{
...
}

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #978:  EditWindow.cs added by None (3KiB - application/octet-stream - file that demonstrates the problem. It isn't the simplest possible case, but I included it because (1) it produces the error I pasted and (2) I was feeling to lazy to make a separate test case file.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-01-22 rweather StatusNone Works For Me
    Open/ClosedOpen Closed
2004-01-15 None Attached File- Added EditWindow.cs, #958

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code