dapr 调式(2)

参考

https://azure.github.io/aca-dotnet-workshop/aca/13-appendix/01-run-debug-dapr-app-vscode/

c#调试中的问题

万物皆可调试-dapr篇的文章中,使用daprd来对c#程序进行调试。在使用dependsOn:build属性进行调试的时候,c#程序无法进行调试,所以删除了dependsOn属性,这个可能是daprd的bug。但在这种情况下,一旦修改代码每次调试前都需要运行下dotnet build。具体可参见https://github.com/microsoft/vscode/issues/176718

对此,我也提了一个issue,https://github.com/microsoft/vscode/issues/181605。

解决办法

虽然执行下dotnet buid也不算麻烦,但是有dependsOn属性,还是应该利用起来,让tasks能按照我们的预期进行执行,修改后的tasks.json如下:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/新しいフォルダー (2).csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "publish",
            "command": "dotnet",
            "type": "process",
            "args": [
                "publish",
                "${workspaceFolder}/新しいフォルダー (2).csproj",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile"
        },
        {
            "label": "watch",
            "command": "dotnet",
            "type": "process",
            "args": [
                "watch",
                "run",
                "--project",
                "${workspaceFolder}/新しいフォルダー (2).csproj"
            ],
            "problemMatcher": "$msCompile"
        },

        {
            "appId": "batch-http",
            "appPort":7001,
            "httpPort":3500,
            "grpcPort":50001,
            "label": "dapr-debug-clr",
            "componentsPath": "C:\\Users\\tengyanbo\\Desktop\\UMFG\\新しいフォルダー (2)\\components",
            "isBackground": true,
            "type": "dapr",
            "dependsOn": "build"
        },
        {
            "label": "daprd-down-clr",
            "appId": "batch-http",
            "type": "daprd-down"
        }
    ]
}

和解释性语言差不多,需要注意下这里的dependsOn即可。这样就能先build,再运行dapr,最后启动C#程序。
在这里插入图片描述

写在最后

dapr调试还是涉及挺多东西的,多多看看配置文件,能对dapr的运行有一个基本的了解。

后续会更新docker的调试,k8s,windbg调试等一系列的调试技巧。

公众号

更多内容,欢迎关注我的微信公众号: 半夏之夜的无情剑客。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

helloworddm

你的鼓励是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值