This did not happen with the April release:
“NETMF and Gadgeteer Package 2013 R1 Update-1”
but it does happen with this release:
“NETMF and Gadgeteer Package 2013 R2”
Has anybody else seen this? Is this a GHI or NETMF issue?
I think NETMF, but is there a way for some of you GHI folks to check it?
I agree, but am hoping that someone has NETMF framework debug ability and could shed some light on why this is happening in VB but not C#.
Here is some VB test code:
Option Explicit On
Option Strict On
Imports Microsoft.SPOT
Imports System
Imports System.Threading
Namespace MFConsoleApplication1
Public Module Module1
Dim timer As Timer
Dim count As Integer = 0
ReadOnly Twenty_milliSeconds As TimeSpan = TimeSpan.FromTicks(TimeSpan.TicksPerMillisecond * 20)
Sub Main()
Debug.Print(Resources.GetString(Resources.StringResources.String1))
timer = New Timer(New TimerCallback(AddressOf TimerCallback), Nothing, Twenty_milliSeconds, Twenty_milliSeconds)
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite)
End Sub
Sub TimerCallback(state As Object)
count += 1
Debug.Print(count.ToString)
End Sub
End Module
End Namespace
And the same test code in C#:
using System;
using Microsoft.SPOT;
using System.Threading;
namespace MFConsoleApplication2
{
public class Program
{
static Timer timer = null;
static int count = 0;
static readonly TimeSpan twenty_milliSeconds = TimeSpan.FromTicks(TimeSpan.TicksPerMillisecond * 20);
public static void Main()
{
Debug.Print(Resources.GetString(Resources.StringResources.String1));
timer = new Timer(new TimerCallback(timerCallback), null, twenty_milliSeconds, twenty_milliSeconds);
Thread.Sleep(Timeout.Infinite);
}
public static void timerCallback(object state)
{
count += 1;
Debug.Print(count.ToString());
}
}
}
The same code, same functionality, but one causes VS2010 to crash.
At the very least, this is a warning to users.
On a hunch I did the same test with a simple Gadgeteer project (Cobra II mainboard).
It works!
Here is the code:
Imports GT = Gadgeteer
Imports GTM = Gadgeteer.Modules
Namespace GadgeteerApp1
Partial Public Class Program
Public Sub ProgramStarted()
Debug.Print("Program Started")
timer.Start()
End Sub
Dim WithEvents timer As GT.Timer = New GT.Timer(1000) ' every second (1000ms)
Dim counter As Integer = 0
Private Sub timer_Tick(timer As Gadgeteer.Timer) Handles timer.Tick
counter += 1
Debug.Print(counter.ToString)
End Sub
End Class
End Namespace
I manually edited the project files of the NETMF project to match exactly the Gadgeteer project. Same crashing result.