ASP.NET Core 프로젝트의 "Enable unmanaged code debugging" 옵션 켜는 방법
.NET Core 프로젝트의 경우 프로젝트 속성 창에서 "Enable unmanaged code debugging" 옵션(EnableUnmanagedDebugging)이 없습니다. 이를 켜려면 수작업 설정이 필요한데요, 이에 대해서는 다음의 이슈에서 언급하고 있습니다.
.NET Core App project Debug properties are missing "enable native code debugging" checkbox #1125
; https://github.com/dotnet/project-system/issues/1125
Add support for native debugging #2766
; https://github.com/dotnet/project-system/pull/2766
즉, launchSettings.json 파일에 다음의 옵션을 추가하면 됩니다.
"nativeDebugging": true
설정 방법은 현재 프로젝트 속성 창의 "Debug" 범주에 선택된 "Profile" 옵션을 우선 확인해야 합니다.
보는 바와 같이 위에서는 "IIS Express" 프로파일로 되어 있습니다. 따라서, Visual Studio의 솔루션 탐색기에서 해당 프로젝트의 "Properties" / "launchSettings.json" 파일을 로드해,
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52826/",
"sslPort": 0
}
},
"profiles": {}
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WebApplication2": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:52827/"
}
}
}
동일한 이름의 프로파일을 "profiles"에서 찾아 그곳에 nativeDebugging 옵션을 다음과 같이 추가해야 합니다.
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52826/",
"sslPort": 0
}
},
"profiles": {}
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"nativeDebugging": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WebApplication2": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:52827/"
}
}
}
이후 F5 키를 눌러 디버깅을 시작하면 다음과 같이 native 콜 스택도 함께 확인할 수 있습니다.
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]