c# - 如何在 Visual Studio 中使用 .NET 5(独立进程)调试 Azure Functions?

标签 c# visual-studio .net-core azure-functions .net-5

我最近从 .NET Core 3.1 迁移到了 .NET 5.0 ( using isolated/out-of-process runtime ),用于 C# 中的 Azure Function 项目。一切都按预期工作。然而,每当我调试时,我的断点都没有命中。为什么我现在不能调试我的 Azure Function 应用程序,但我以前可以?

最佳答案

有一个简单的方法!

public static class Program
{
    public static void Main()
    {
        Debugger.Launch(); // The trick! <<=======================================

        using var host = new HostBuilder()
...
然后像往常一样启动而不调试 (Ctrl+F5) 并将相同的 Visual Studio 实例附加到 dotnet 进程
Attach debugger
瞧,您调试了您的功能!

关于c# - 如何在 Visual Studio 中使用 .NET 5(独立进程)调试 Azure Functions?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67526631/

相关文章:

visual-studio - Visual Studio 的 Cmake 生成器不设置 CMAKE_CONFIGURATION_TYPES

visual-studio - Visual Studio和多个合并/比较工具

c# - 如何使 .net core 3.1 控制台应用程序中的控制台记录器工作

c# - 这个计算 Code128 条码校验位的代码是否正确?

c# - Windows 8 本地存储

c# - 我如何使用C#将网页保存为文本文件以供以后解析

c# - 重构。使用大方法降低大类代码复杂性的方法

javascript - 如何在 VS 命令窗口中列出 JavaScript 对象的方法?

asp.net-core - 更改 IdentityServer 4 中的默认端点

c# - Byte[] 在 REST API 中作为 base64 返回