I had the same issue today working on a fresh linux install on my laptop.
I figured that the simulator needs 3 steps:
- setup (using a real device connection string)
- start (actually runs docker-compose, and if use -v, will show docker logs)
- stop
I setup vscode and going through the example at
https://learn.microsoft.com/en-us/azure/iot-edge/how-to-vs-code-develop-module?view=iotedge-2020-11
then find out several things:
- first vscode detects that there is a DevContainer definition, and offers to open in DevContainer - which I did but is unexpected
- that means that setup for azureiothubdev on the host linux is unnecessary
- and that had issues with versions of pyyaml , had to downgrade to 5.4.1
- will now uninstall this
- second, when I try to right click (contextual menu in Azure Iot Hub extension) on the device I choose to run the simulator as, it does 'setup IoT Edge Simulator' correctly.
- third, when trying the command palette approach to 'Run IoT Edge Solution in the simulator', it does what the OP describes, with a popup at the bottom asking to choose the device, and when done with setup, just stops there.
In the end, I read the instructions related to the Azure Iot EdgeHub dev tool
https://github.com/Azure/iotedgehubdev.
Here is how I got it to work:
- ran 2 actions in contextual menu for deployment.debug.template.json,
- Generate IoT Edge Deployment Manifest
- Build and Push IoT Edge Solution
- ran 1 action in the context menu for my device in AZURE IOT HUB extension
- Setup IoT Edge Simulator, which runs commands in the terminal
- ran one command manually in the terminal to fill the gap
sudo "iotedgehubdev" start -d ./config/<your debug deployment file> -v
- stopped on a breakpoint in the sample module (the whole point of the endeavor)
- in your module, set a breakpoint, in a message handler perhaps
- enter debug menu (CTRL+SHIFT+D)
- select the config for your (C#) module with 'Remote Debug'
- click Start Debugging (empty green triangle) or press F5
- select the process matching your entrypoint in the dockerfile (mine was 'dotnet SampleModule.dll')
At this point you are attached to the program running in a container, and the breakpoint should get hit as expected.
you can't use the command palette to stop the simulator, if you have the -v option where docker-compose gives you logs. the command gets written to the terminal and does nothing in the middle of the logs.
you just have to Ctrl+C in the terminal to end the simulation, though edgehub keeps running.
You stop it with
sudo "iotedgehubdev" stop