How to debug IOT edge modules running as Linux containers from Visual studio

Anjitha Ts 5 Reputation points
2023-11-29T12:38:38.1866667+00:00

We have an IOT Edge application with multiple IOT C# modules. These IOT modules are containerized and deployed in Linux hardware. These IOT modules communicate using GRPC. We are using Visual studio 2022 for development and docker desktop for building docker images.

We are searching for any methodologies to debug the running containers from Visual studio . We have tried out debug by attaching container as process in Visual studio. But it’s not working.

Suggest any other methodologies to debug the containers from visual studio.

Thanks in advance.

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
560 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 31,116 Reputation points MVP
    2023-11-29T13:08:24.01+00:00

    Hello @Ranjitha TS ,

    welcome to this moderated Azure community forum.

    If you check the documentation, the use of the Azure IoT Dev Tool (also available as extension) is advertised.

    Personally I'm not fond of this approach, here are my 50 cents.

    Usually, I put the custom logic as a singleton class inside the template and use methods and events to connect the ModuleClient logic to that singleton.

    This way, I have create two separate parts with minimal interaction:

    • A class with all the custom logic which is manipulated by methods and emits events
    • The ModuleClient template which just passes on message to and from the singleton.

    This way, the singleton class is unit-testable or can even be put in a console app if needed.

    Standard developers can work on it.

    If something goes wrong, it's easy to identify if the fix is needed in the single ton or the moduleclient 'wrapper'.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments