The System.Timers.Timer class will swallow all exceptions from the timer 
causing this to happen (and apparently has no way to report those to the user).

You could use either System.Windows.Forms.Timer or System.Threading.Timer to 
avoid that problem assuming there isn't some functionality from 
System.Timers.Timer that you actually need.  Then the unhandled exception will 
cause Watson to be invoked like a normal CLR app.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Davy Mitchell
Sent: Friday, January 05, 2007 5:39 AM
To: Discussion of IronPython
Subject: [IronPython] Bug?

In the example below, hello is printed but there is no error for the
call on the non-existent method. Is this something to do with the
timer thread?

Cheers,
Davy

import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')

from System import *
from System.Drawing import *
from System.Drawing.Drawing2D import *
from System.Windows.Forms import Application, Button, Form, Label,
TextBox, FolderBrowserDialog, Timer, FormWindowState,
FormBorderStyle,ImageLayout, MenuStrip, ToolStripMenuItem,
ToolStripItem
from System.Timers import Timer

class ScreenForm(Form):

    def __init__(self):
        Form.__init__(self)
        self.Change = Timer()
        self.Change.Elapsed += self.ChangeTick
        self.Change.Interval = 3000
        self.Change.Enabled = True

    def Closeform(self, s, e):
        self.Change.Enabled = False
        self.Close()

    def ChangeTick(self, s, e):
        print "hello!"
        self.UpdatePicture()

Application.EnableVisualStyles()
form = ScreenForm()
Application.Run(form)

--
Davy Mitchell
Blog - http://www.latedecember.com/sites/personal/davy/
Mood News
 - BBC News Headlines Auto-Classified as   Good,   Bad or   Neutral.
 http://www.latedecember.com/sites/moodnews/
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to