Main Site Documentation

DHCP-USBHost bug : The debugger engine failed to receive any debug events from the debugging target


#1

Here is the code

Problem :
using Ethernet.UseDHCP seems to make the debugger to blow up with the following output message :

Code :

public partial class Program
{
	void ProgramStarted()
	{
		ethernet.UseDHCP();
		usbHost.USBDriveConnected += usbHost_USBDriveConnected;
	}

	void usbHost_USBDriveConnected(UsbHost sender, Gadgeteer.StorageDevice storageDevice)
	{
	}
}

Reproduce :
Run the program.
Set a breakpoint in usbHost_USBDriveConnected.

Result :
it will never break, and debug mode will blow up.
Remove ethernet.UseDHCP, then everything works fine.

Observations :

NetworkInterface.GetAllNetworkInterfaces()[0].EnableDhcp();

Trigger the same problem

moving ethernet.UseDHCP in usbHost_USBDriveConnected does not solve the problem.


#2

UseDhcp is a blocking call and can take many seconds. try putting a Thread.Sleep(1000) before the call to allow the debugger to get attached.

you might have to use mfdeploy to erase the current program.


#3
void ProgramStarted()
{
	ethernet.UseDHCP();
	Thread.Sleep(15000);
	usbHost.USBDriveConnected += usbHost_USBDriveConnected;
}

Does not work, I keep StaticIp for now, I think it’s a bug.


#4

I suggested putting the sleep before the UseDHCP. You put it after… :wink:

Did you do an erase with MFDeploy?


#5

I [quote]suggested putting the sleep before the UseDHCP. You put it after…
[/quote]
I’ll see that and raise by putting the UseDHCP call in a separate thread…


#6

I believe DHCP locks the entire system. I don’t think putting it into a thread will help except for delaying the execution.


#7

Mike, UseDHCP does not block, I successfully break after it. The debugger crash just after ProgramStarted ends.

I don’t erase firmware now, I must continue my project and can use StaticIp for my tests.
When I will erase I’ll post result here.