timer issue

Hello,

I'm trying to use a System.Threading.Timer in a class in a DLL library, however, the timer never seems to fire. If I move the class into the project that declares the over all object it works fine, but if it's in a different dll it never fires. Any Ideas

Simple example create 2 projects one a classlib and one a smardevice application, put the testreader class in the classlib and create a button on the smartdevice appliation form as shown in the form1 class. the timer's callback method (readcard) is never called. if you change it and put the testreader class in the smartdevice application, readcard is called like you'd expect:

Public Class testreader

Private t as system.threading.timer

public sub startTimer()

t = New System.Threading.Timer(New System.Threading.TimerCallback(AddressOf readcard), Nothing, 500, 500)

end sub

private sub readcard(state as object)

dim x as integer
x = 4

end sub

Public Class Form1

Private reader As MobileTicketing3.TicketInterfaces.ICardReader

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

reader = new testreader

reader.startTimer()

End Sub

End Class

Thanks
Robert Brown



Answer this question

timer issue

  • zr119_62

    Hi Robert,

    I cannot reproduce the problem you described. It works just fine for me regardless whether the TestReader class is in the exe or dll. I put a messagebox into the readercard method and, as expected, the messagebox shows up every time the timer fires. There must be something else in the project that causes the problem.

    Thank you.


  • timer issue