最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

debugging - How to debug C# and .Net Projects on Emacs? - Stack Overflow

programmeradmin5浏览0评论

I'm trying to debug a .Net Core project. I'm using emacs lsp and dap mode. But when I run dap-debug I get the message:

Have you loaded the ‘coreclr’ specific dap package?

I just want to debug my project, I don't care if I got it with dap or other tool, please help me. At the moment this is my configuration:

(unless (package-installed-p 'dap-mode)
    (package-refresh-contents)
    (package-install 'dap-mode))

  (require 'dap-mode)
  (require 'dap-netcore)

  (use-package dap-mode
    :custom
    (dap-netcore-download-url ".1.2-1054/netcoredbg-win64.zip")
    (dap-netcore-install-dir "C:\netcoredbg"))

  (dap-register-debug-template
   "C# .NET Core Launch"
   (list :type "coreclr"
 :request "launch"
 :name "C# .NET Core Launch"
 :program "${workspaceFolder}/bin/Debug/net6.0/MyApplication.dll"
 :cwd "${workspaceFolder}"
 :stopAtEntry nil
 :env (list "ASPNETCORE_ENVIRONMENT" "Development")))

I'm trying to debug a .Net Core project. I'm using emacs lsp and dap mode. But when I run dap-debug I get the message:

Have you loaded the ‘coreclr’ specific dap package?

I just want to debug my project, I don't care if I got it with dap or other tool, please help me. At the moment this is my configuration:

(unless (package-installed-p 'dap-mode)
    (package-refresh-contents)
    (package-install 'dap-mode))

  (require 'dap-mode)
  (require 'dap-netcore)

  (use-package dap-mode
    :custom
    (dap-netcore-download-url "https://github/Samsung/netcoredbg/releases/download/3.1.2-1054/netcoredbg-win64.zip")
    (dap-netcore-install-dir "C:\netcoredbg"))

  (dap-register-debug-template
   "C# .NET Core Launch"
   (list :type "coreclr"
 :request "launch"
 :name "C# .NET Core Launch"
 :program "${workspaceFolder}/bin/Debug/net6.0/MyApplication.dll"
 :cwd "${workspaceFolder}"
 :stopAtEntry nil
 :env (list "ASPNETCORE_ENVIRONMENT" "Development")))
Share Improve this question edited Mar 18 at 16:04 cali asked Mar 18 at 4:34 calicali 14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

SOLUTION

I have been able to solve my problem. I had to modify my configuration as follows:

 (use-package dap-mode
    :ensure t
    :after lsp-mode
    :config
    (require 'dap-netcore)
    (setq dap-netcore-download-url "https://github/Samsung/netcoredbg/releases/download/3.1.2-1054/netcoredbg-win64.zip")
    (setq dap-netcore-install-dir "C:/Users/carlosreyes/netcoredbg")
    (setq dap-netcore--debugger-cmd "C:/Users/carlosreyes/netcoredbg/netcoredbg")

    ;; EJEMPLO DE PLANTILLA
    (dap-register-debug-template
     "wsnetcore"
     (list :type "coreclr"
       :request "launch"
       :mode "launch"
       :name "C# .NET Core Launch"
       :program "C:\\Users\\carlosreyes\\Documents\\FUENTES\\WSNetCore\\WSNetCore\\bin\\Debug\\net6.0\\WSNetCore.dll"
       :args '("watch")
       :cwd "C:\\Users\\carlosreyes\\Documents\\FUENTES\\WSNetCore\\WSNetCore\\bin\\Release\\net6.0\\"
       :env (list "ASPNETCORE_ENVIRONMENT" "Development")
       :debugger "netcoredbg"
       :postDebugHook (lambda () (browse-url "https://localhost:5035"))))

    )

My previous configuration was missing the :mode parameter. In addition to this, the path specified in the :cwd parameter must be the path where the dll's in Release mode are located. And the path specified in the :program parameter must be the path to the dll's in Debug mode.

发布评论

评论列表(0)

  1. 暂无评论