Simple Blinky fails with no obvious problems

Can anyone give me a hint (or debugging suggestion) why this simple program would quit blinking and sending debug data? It runs fine for about a half-hour then stops, but VS says it’s still running. It’s on a Fez Duino. Looking at the memory management docs it should be ok. Garbage collected? Doesn’t look like any race condition. I tried a variation where Blink just set a flag and the LED handled in a main loop, and that also had the same problem. Looks like main is still running but the timer is no longer getting triggered for some reason. Thanks!

	static GpioPin LED;

	static void Main()
	{
		LED = GpioController.GetDefault().OpenPin(SC20100.GpioPin.PE11);
		LED.SetDriveMode(GpioPinDriveMode.Output);

		new Timer(Blink, null, 1000, 5000);
		Thread.Sleep(Timeout.Infinite);
	}

	static void Blink(object o)
	{
		DateTime dt = DateTime.UtcNow;
		Debug.WriteLine(dt.ToString());

		LED.Write(GpioPinValue.High);
		Thread.Sleep(200);
		LED.Write(GpioPinValue.Low);
	}

Create a static that will hold the reference to the Timer you are creating, similar to what is doing for the LED. If I had to guess the GC is collecting the timer at some point, which kills the timer.

Yes, thanks - that’s what is happening. I added System.Diagnostics.Debug.EnableGCMessages(true); and it spits out some not very helpful info just before Blink stops getting called.