Debugging target failed to initialize

I am currently using VS2015 on one of my laptops and although unsupported it seems to work with NetMF4.3 (with powershell script in code share) and VS2015 project system from 4.4 / Gadgeteer Core v2.44.1100 & lastly the GHI SDK 2015 R1.

Everything works as expected, (excluding GHI templates, but no Biggy as I am working on an existing project) including the debugger from within MFDeploy, however when I try to deploy and debug from within VS2015 I get


...
Incrementally deploying assemblies to device
Deploying assemblies for a total size of 401936 bytes
Assemblies successfully deployed to device.
Restarting interpreter...
Attaching to device...
Waiting for device to initialize...
The debugging target and the debugger engine failed to initialize because of unspecified device errors.
The debugger engine thread has terminated unexpectedly with error 'Could not reconnect to the debugging target after rebooting it.'.

the last 2 statements happen instantaneously when the device reboots, and just as the “usb detached” sound occurs.

TBH I am not sure if it actually a problem with VS, or the USB chipset on my surface pro 2…

does anyone have any ideas how I can diagnose / fix this?!

No one?! I guess it will have to wait until the new SDK is released… I just hope it isn’t hardware related ???

@ networkfusion - How are you powering the netmf device? It may be under powered. If not then try reflashing the firmware. Put it into boot loader mode and reload the firmware.

@ Mr. John Smith - Powered through the USB, but I have also tried powering separately. There is definitely nothing wrong with the firmware etc as I have been quite happily debugging one of the same boards on a different computer (although ancient) running VS2013 this evening…

@ networkfusion - Change the USB cable.

nope, definitely not the USB cable, anyway the debugger has already timed out before the device has had time to disconnect from the computer…

This will sound weird, but I’ll put it out there anyway because I have repro’d it several times… When encountering the same error, I changed the debug target on the deployed project to “Emulator” or “Serial” and then back to USB and it cured the problem. It seems that VS is caching something that it shouldn’t.

@ mcalsyn - unfortunately it has no effect in my case. A weird thing I have just noticed though is the fact that the program always freshly deploys to the device when I haven’t changed anything, rather than the usual “no deployment necessary” message… strange!

@ andre.m - Did you uninstall and then reinstall everything (inc. the netmf framework) or just reinstall VS over the top?

Given the new SDK will not be supporting VS2015, I wont bother reinstalling it and will just install VS2013 as well #sigh

Hi ,
This is amar, i am new to .NETMF and C# application in Visual studio.

Now i am facing an below issue(s) while debugging C# application in Visual Studio.

  1. The debugging target and the debugger engine failed to initialize because of unspecified device errors.
    The debugger engine thread has terminated unexpectedly with error ‘Could not reconnect to the debugging target after rebooting it.’.
  2. Break points are not hitting while debugging in code.

I have tried below experiments on my board:

  1. Made visual studio setting as mentioned in below link
    BreakPoints Are Not Working in Visual Studio
  2. After pressing (F5) in Visual studio , list of Module’s/assemblies’ are not visible during debugging state (Ref: MyBoard\Modules_NotListed_Down.png ).
  3. I found some details in the internet, ‘Microsoft.SPOT.Debugger.CorDebug.12.dll’ is loading the assemblies during debugging process in Visual studio so i have tried to add similar “Microsoft.SPOT.Debugger.CorDebug.dll” in references. I got an error in Visual studio “Microsoft.SPOT.Debugger.CorDebug.pe” file is not found. (Ref: MyBoard\VS2013_Addreference Information.png).
  4. My target board comport interface is “serial port”.

Environment Details:
Operating System : Win 7 / 64 bit
Processor : Intel Core ™ i5 -4590 CPU @ 3.30 Gz
Visual Studio : 2013 Premium / 2012 Professional with SP4
SDK : netmf-v4.3.2-SDK-QFE2-RTM
.NETMF PK : MicroFrameworkPK_v4_3

Thanks in-advance & Regards,
Amar P

@ amarputsala - Can you try to reflash the firmware on your board, including TinyBooter? Have you installed only what is found on .NET Micro Framework – GHI Electronics?

You do not need to add a reference to Microsoft.SPOT.Debugger.CorDebug.12.dll.

@ John - Thank you for response…,
Yes , i reflashed the TinyBooter and firmware image on my board.
As you mentioned in below link step 4: Install “GHI Electronics NETMF SDK 2015 R1” required only for GHI target boards. Is it my understanding is correct?. currently i have installed “SDK : netmf-v4.3.2-SDK-QFE2-RTM” for C# application.

@ amarputsala - Our SDK is required if you need to update the firmware, use Gadgeteer, or use any of our libraries.

Does deploying work if you use the USB transport?

@ john - yes , deployment is succeeded with “Serial Port” ( Currently my board is supporting only Serial port.). while using ‘F5’ option in Visual studio for debugging , it throws an error " debugger engine failed to initialize because of unspecified device errors." eventually break points are not hitting.

@ amarputsala - I mean if you use the USB debug interface instead of serial, does the debugger work properly?

@ john - Currently my board USB port is not working so i used serial port for deployment and debug process. My observation is deployment success rate is very less (4 times out of 10 trails with c# code size limit is 4K) in visual studio.

So, there’s a good chance your problem is in your firmware - although the failure mode is more likely to be zero success than this partial success. Do you have a commercial device you can use as a comparison? Also, most people here don’t stress test deployment over serial, so I’d spend lots of time getting your USB working :slight_smile: .

John - I have netduino plus 2 board which is working good (Debugging and hitting the break points in visual studio) with USB port.
My observation on netduino plus 2 board :

  1. Break points are hitting in case of Administrator account. (Ref: HittingBreakPoint.png)
  2. ‘Microsoft.SPOT.Debugger.CorDebug.12.dll’ is responsible for loading the assemblies during debugging process in
    Visual studio (Ref: OutputWindow).
  3. If I choose Netduino SDK template for C# application, all supported DLL’s are coming in “References” list.
  4. Hitting the break points even excluding the netduino dependent dll files.
    a. Wrote sample C# application which exclude below assemblies from Netduino SDK template(in Visual studio).
    using SecretLabs.NETMF.Hardware;
    using SecretLabs.NETMF.Hardware.Netduino;
    b. Remaining *.dll’s are loaded from “Program x86” folder during debugging stage.
    c. Ref: Excluding Netduino DLLS during debugging process.

can you use serial debug with your netduino, to prove that your serial port hardware is reliable?