G120 - code works fine in debugger, not outside Visual Studio


I have some code (configure Ethernet ENC28 module for DHCP and starting DPWS service) running in Debug mode in Visual Studio. It runs as expected, and I see announcement messages captured on the network. However, after deploying the application (right click in Solution Explorer and choosing “Deploy”) and reconnecting the USB cable, the code seems to no longer run (I don’t see messages appearing on the network, outside of IGMPv2 Membership, no DHCP, no SOAP for DPWS broadcast). I removed DHCP and set a static IP address, but to no avail. It seems


doesn’t do anything if running outside of the debugger.

Has anyone encountered this issue or am I doing something else wrong that anyone can point me at?


Thanks for your reply. I’m using the WCF sample from netmf 4.2 SDK (HelloWorldServer_MF). It uses DPWS to enable WCF service hosting. I believe the issue was caused by a race condition where the Device.Start was called before the ENC28 had it’s static IP address set, something which doesn’t occur under the debugger (probably because that is much slower). After injecting Thread.Sleep(500) when setting the static IP address, the issue disappears and the device functions correctly. Ofcourse, using DHCP and a ManualResetEvent is next, but for now, the issue seems resolved.

Besides deleting this question, as I cannot check my own reply as an answer, what’s the best option?