Visual Studio 2010 Crash during Debugging

I filed this issue on codeplex:

This happens with hardware (G120 or Cobra II) or without (emulator).

This only happens with VB.NET not C#.

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?

This is costing me so much time.

Regards,
Clif

Hi Andre,

Sorry bout this…

the link is netmf.codeplex.com (Slash) workitem (Slash) 2129

I am using the default USB drivers.

This also happens on the Emulator.

Regards,
Clif

It’s visible when you quote it ! :slight_smile:

Thanks Brett

Andre,

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.

I can try VB code tomorrow in 2010, to verify.

That would be fantastic.

The plot thickens…

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.

Did you set the framework to 4.2 instead of 4.3?

I do not have 4.3 installed.

I am using:

Visual Studio 2010 (Don’t have 2012 or .NET 4.5 installed).
NETMF SDK 4.2 (RTM QFE2).
NETMF and Gadgeteer Package 2013 R2