4

I have a VB.NET application, which uses a timer:

MyTimer_Tick
    ModifySomeGlobalDateTimeVariables()
    ModifySomeLabels()

On Windows it works good, but when I try it on Linux, it crashes after some time. I have Winetricks installed, added all the libraries that I need (I think), dotnet20, corefonts, riched20, riched30, etc.

Any idea why it crashes? (no exceptions, and ...&>log.txt doesn't work)

e-MEE
  • 508
  • 1
  • 8
  • 16
  • Have you tried running it under mono? `mono myexecutable.exe` without wine – Eugen Rieck Jan 23 '12 at 14:27
  • @EugenRieck no, but I need this to work with Wine – e-MEE Jan 23 '12 at 14:36
  • 1
    I changed my `System.Windows.Forms.Timer` with `System.Timers.Timer`, now it can't interfere with the UI, and I think it doesn't crash anymore, so if no one has a better idea, I'll make this an answer – e-MEE Jan 24 '12 at 08:48

1 Answers1

2

According disassemble information, System.Windows.Forms.Timer during setting the Enabled property has try block without any catch and re-throw, so I think your issue is caused by this behaviour.

System.Timers.Timer uses System.Threading.Timer in background, and has much more clear code during initializing. You can also read about it here.

So your choice to change the class is quite right.

Community
  • 1
  • 1
VMAtm
  • 27,943
  • 17
  • 79
  • 125