Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
396 views
in Technique[技术] by (71.8m points)

Debugging Azure IoT Edge Module C# (how to hit a breakpoint)

I am trying to debug an IoT edge module. According to https://docs.microsoft.com/en-us/azure/iot-edge/how-to-vs-code-develop-module?view=iotedge-2018-06#build-and-run-container-for-debugging-and-debug-in-attach-mode I should (2) right-click on deployment.debug.template.json but I don't see that file. There is a file called module.json and when I right-click on it I see:

enter image description here

Is there a way to do this in VS that would be easier?

question from:https://stackoverflow.com/questions/65891979/debugging-azure-iot-edge-module-c-sharp-how-to-hit-a-breakpoint

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you just want to hit a breakpoint, and don't need to run the module as a container on your dev machine, you can follow these steps. That way you're using the IoT Edge Simulator instead of running it on the IoT Edge Runtime. When you run it this way, you supply the simulator with a device connection string (you can just create a new one in an IoT Hub) and the simulator will create a new module called target on the device in IoT Hub. You can interact with the module (Direct Methods, Module Twins) by targeting that module.

Alternatively, if you do want to follow the steps in the link you provided, you do need that deployment file. When you create a new IoT Edge Solution using VS Code, it will supply this file for you. Example:

Starter project


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...