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.com/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")))
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.com/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.