Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to debug module filtermodule created by ioteddev solution init? #620

Open
RollsChris opened this issue Feb 23, 2024 · 3 comments
Open

Comments

@RollsChris
Copy link

I am having the same issue trying to debug my module inside the simulator.

The filtermodule doesn't have the Dockerfile.windows-amd64.debug file when created with the iotedgedev solution init
and running dotnet publish --os linux --arch x64 /t:PublishContainer seems to create a production ready container without vsdbg installed

im on a windows machine with linux containers, im actually developing inside the iotedgedev container with the simulator running with the image genearated with dotnet publish --os linux --arch x64 /t:PublishContainer ...

when i f5 i get:

Starting: "docker" exec -i filtermodule sh -c "~/vsdbg/vsdbg --interpreter=vscode"
Error from pipe program 'docker': sh: 1: /home/app/vsdbg/vsdbg: not found
The pipe program 'docker' exited unexpectedly with code 127.

Any ideas?

thank you

@RollsChris
Copy link
Author

RollsChris commented Feb 26, 2024

It seems like you still need to use the Dockerfile and module.json files to get it debugging:

Dockerfile

FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base

RUN apt-get update
RUN apt install -y curl
RUN apt-get install -y --no-install-recommends unzip procps
RUN rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash moduleuser
USER moduleuser
RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Debug -o out

FROM base
WORKDIR /app
COPY --from=build-env /app/out ./

ENTRYPOINT ["dotnet", "app.dll"]

module.json

{
    "$schema-version": "0.0.1",
    "description": "",
    "image": {
        "repository": "localhost:5000/app",
        "tag": {
            "version": "0.0.1",
            "platforms": {
                "amd64": "./Dockerfile.amd64", 
                "amd64.debug": "./Dockerfile.amd64.debug"
            }
        },
        "buildOptions": []
    },
    "language": "csharp"
}

then when you run the command:

iotedgedev simulator start -b -f deployment.debug.v6.template.json

I think it looks at the module.json and builds the dockerfile.

This should now allow you to use f5 for debugging.

Hope this helps someone else
Thanks

@konichi3
Copy link
Collaborator

We recommend using IoT Edge runtime to debug your edge module.
Instrustuction here.

@RollsChris
Copy link
Author

We recommend using IoT Edge runtime to debug your edge module. Instrustuction here.

This links to the iotedge extension method which Is in maintenance and the cli method seems out of date and what I tried to follow originally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants