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

Submitted by:  None
Submitted on:  Thu 15 Jan 2004 05:54:49 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Works For Me
Privacy: PublicAssigned 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>
Project 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

 

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

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Thu 22 Jan 2004 05:21:12 AM UTCrweatherStatusNone=>Works For Me
  Open/ClosedOpen=>Closed
Thu 15 Jan 2004 05:54:49 AM UTCNoneAttached File-=>Added EditWindow.cs, #958

Back to the top


Powered by Savane 3.1-cleanup1