If you have no done so already, harvest some of the power sitting in VS waiting to be used.
VS added some really good thread debugging support. Ever wonder what thread is calling that button interrupt code? Catch it in action with the Debug Threads windows.
- Set a break point in your callback.
- Run your code till it hit break point (i.e. push that button or timer).
- While your code is halted, open a Debug/Windows/Threads window.
As seen below, I have two active threads. The first is the Main thread that is blocked on Thread.Sleep(-1). The second (Id:3) is the callback thread the system created to call my port interrupt event code.
In .Net that second thread would be either a thread pool thread or a completion port thread. In NETMF, I don’t think either of those exists, but NETMF does a good job making that happen anyway via some abstration. I think maybe it uses some APM passing style. In any case, show that to your Arduino buddies.