dotnet / dotnet/vscode-csharp

Debugger will not stay attached (Mac, .NET 6, Azure Function Core Tools 4.x)

Open
#4,903 46 comments 22 reactions 0 assignees View on GitHub
Debugger Triaged
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
17h 56m
Merged PRs (30d)
21

Description

## Issue Description ##
Attaching the debugger to an Azure Functions Core Tools running process (dotnet runtime - not dotnet-isolated) seems to attach for a second or two and then just detach with no errors/useful information reported.

## Steps to Reproduce ##
1. install Azure Functions Core tools
2. func init --worker-runtime dotnet
3. func new
4. select any function type *I selected HTTP trigger
4. set a breakpoint or two in the resulting generated function file (.cs)
5. func start --verbose *note the process ID from the output once the function is started
6. attach to running process with standard coreclr debugger configuration

## Expected Behavior ##
Debugger attaches to the underlying process and waits for breakpoints to be hit. (I.e. when you manually trigger the function via cURL/Postman against localhost)

## Actual Behavior ##
Debugger attaches for a few seconds and then detaches.

## Logs ##

caseyboyle@Zerocool x86_64 % ./vsdbg-ui --server --consoleLogging
Waiting for communication on port 4711...
>> accepted connection from client
-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true},"type":"request","seq":1}
<- (R) {"seq":1,"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":true,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"all","label":"All Exceptions","description":"Break when an exception is thrown. For more information about exception settings, see: https://aka.ms/VSCode-CS-ExceptionSettings","default":false,"supportsCondition":true,"conditionDescription":"Comma-separated list of exception types to break on, or if the list starts with '!', a list of exception types to ignore. \nExample 1: System.NullReferenceException -- this will break on just null reference exceptions. \nExample 2: !System.Threading.Tasks.TaskCanceledException -- this will break on all exceptions except for task canceled.\n\nFor more information about exception settings, see: https://aka.ms/VSCode-CS-ExceptionSettings"},{"filter":"user-unhandled","label":"User-Unhandled Exceptions","description":"Break when an exception is caught in non-user code (system code) after having passed through user code. For more information about exception settings, see: https://aka.ms/VSCode-CS-ExceptionSettings","default":true,"supportsCondition":true,"conditionDescription":"Comma-separated list of exception types to break on, or if the list starts with '!', a list of exception types to ignore. \nExample 1: System.NullReferenceException -- this will break on just null reference exceptions. \nExample 2: !System.Threading.Tasks.TaskCanceledException -- this will break on all exceptions except for task canceled.\n\nFor more information about exception settings, see: https://aka.ms/VSCode-CS-ExceptionSettings"}],"supportsSetVariable":true,"supportsGotoTargetsRequest":true,"supportsModulesRequest":true,"supportedChecksumAlgorithms":["MD5","SHA1","SHA256"],"supportsExceptionOptions":true,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":true,"supportsSetExpression":true,"supportsReadMemoryRequest":true,"supportsCancelRequest":true,"supportsExceptionFilterOptions":true,"supportsExceptionConditions":true,"supportsLoadSymbolsRequest":true,"supportsModuleSymbolSearchLog":true,"supportsDebuggerProperties":true,"supportsSetSymbolOptions":true,"supportsHitBreakpointIds":true,"supportsVsIndividualBreakpointOperations":true,"supportsVsBreakpointLanguage":true,"supportsSetHitCount":true,"supportsVsCustomMessages":true,"supportsEvaluationOptions":true,"supportsExceptionStackTrace":true,"memoryReferencesAreAddresses":true,"supportsObjectFavorites":true,"supportsObjectId":true,"supportsVariableEnumerators":false}}
-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true},"type":"request","seq":1}
-> (C) {"command":"attach","arguments":{"name":".NET Core Attach","type":"coreclr","request":"attach","targetArchitecture":"x86_64","logging":{"engineLogging":false},"debugServer":4711,"__configurationTarget":5,"processId":"91151","env":{},"__sessionId":"81c97450-aaab-499c-a87f-77ebfec3a684"},"type":"request","seq":2}
<- (E) {"seq":4,"type":"event","event":"output","body":{"category":"console","output":"-------------------------------------------------------------------\nYou may only use the Microsoft .NET Core Debugger (vsdbg) with\nVisual Studio Code, Visual Studio or Visual Studio for Mac software\nto help you develop and test your applications.\n-------------------------------------------------------------------\n","severity":"ok"}}
<- (R) {"seq":5,"type":"response","request_seq":2,"success":true,"command":"attach"}
<- (E) {"seq":6,"type":"event","event":"initialized","body":{}}
-> (C) {"command":"setBreakpoints","arguments":{"source":{"name":"ProductFunction.cs","path":"/Users/caseyboyle/Repositories/TrueVelocity/TrueVelocity.Web/TrueVelocity.Web.API/TrueVelocity.Web.API.Admin/ProductFunction.cs","checksums":[{"algorithm":"SHA1","checksum":"f3946cc4c093df5868a5c4e746322a6c0e6786b2"},{"algorithm":"SHA256","checksum":"1edfc0c3508b26eef8172e1095dde1198a58fb819319ca61b07a2c85e05ba8b7"},{"algorithm":"SHA1","checksum":"4cbbef07e3692bb0c2f4dfa2ec2fc5b044e5dbf7"},{"algorithm":"SHA256","checksum":"9b7bf2983b3e40f46bd6bfbe6b40b69e94334890b92204b616eb6e63f65258d5"}]},"lines":[27],"breakpoints":[{"line":27}],"sourceModified":false},"type":"request","seq":3}
-> (C) {"command":"setBreakpoints","arguments":{"source":{"name":"Startup.cs","path":"/Users/caseyboyle/Repositories/TrueVelocity/TrueVelocity.Web/TrueVelocity.Web.API/TrueVelocity.Web.API.Admin/Startup.cs","checksums":[{"algorithm":"SHA1","checksum":"ab24777f2aa4e957bcd8794e0aaa6f4f767d945b"},{"algorithm":"SHA256","checksum":"11dd96137695a0c24b41125a237409de127de78024900069e1413fe6bf16cf03"},{"algorithm":"SHA1","checksum":"dd1fc5dffccf73a6f188c8865efbb15320d707e0"},{"algorithm":"SHA256","checksum":"45b578b4a1e99aa705b1931fba2eb38fa72cb50916041e1e0ff3f8126651ad2e"}]},"lines":[21],"breakpoints":[{"line":21}],"sourceModified":false},"type":"request","seq":4}
<- (R) {"seq":7,"type":"response","request_seq":3,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":1,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts.","line":27}]}}
<- (R) {"seq":8,"type":"response","request_seq":4,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":2,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts.","line":21}]}}
-> (C) {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":5}
<- (R) {"seq":9,"type":"response","request_seq":5,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]}}
-> (C) {"command":"setExceptionBreakpoints","arguments":{"filters":[],"filterOptions":[{"filterId":"user-unhandled"}]},"type":"request","seq":6}
<- (R) {"seq":10,"type":"response","request_seq":6,"success":true,"command":"setExceptionBreakpoints","body":{"breakpoints":[{"verified":true}]}}
-> (C) {"command":"configurationDone","type":"request","seq":7}
zsh: killed ./vsdbg-ui --server --consoleLogging
caseyboyle@Zerocool x86_64 %

### OmniSharp log ###
-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true},"type":"request","seq":1}
-> (C) {"command":"attach","arguments":{"name":".NET Core Attach","type":"coreclr","request":"attach","targetArchitecture":"x86_64","logging":{"engineLogging":false},"__configurationTarget":5,"processId":"91537","env":{},"__sessionId":"52709662-bb8b-45b8-a94b-1df9b44b81ba"},"type":"request","seq":2}
<- (E) {"seq":4,"type":"event","event":"output","body":{"category":"console","output":"-------------------------------------------------------------------\nYou may only use the Microsoft .NET Core Debugger (vsdbg) with\nVisual Studio Code, Visual Studio or Visual Studio for Mac software\nto help you develop and test your applications.\n-------------------------------------------------------------------\n","severity":"ok"}}
-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
<- (R) {"seq":5,"type":"response","request_seq":2,"success":true,"command":"attach"}
<- (E) {"seq":6,"type":"event","event":"initialized","body":{}}
-> (C) {"command":"setBreakpoints","arguments":{"source":{"name":"ProductFunction.cs","path":"/Users/caseyboyle/Repositories/TrueVelocity/TrueVelocity.Web/TrueVelocity.Web.API/TrueVelocity.Web.API.Admin/ProductFunction.cs","checksums":[{"algorithm":"SHA1","checksum":"f3946cc4c093df5868a5c4e746322a6c0e6786b2"},{"algorithm":"SHA256","checksum":"1edfc0c3508b26eef8172e1095dde1198a58fb819319ca61b07a2c85e05ba8b7"},{"algorithm":"SHA1","checksum":"4cbbef07e3692bb0c2f4dfa2ec2fc5b044e5dbf7"},{"algorithm":"SHA256","checksum":"9b7bf2983b3e40f46bd6bfbe6b40b69e94334890b92204b616eb6e63f65258d5"}]},"lines":[27],"breakpoints":[{"line":27}],"sourceModified":false},"type":"request","seq":3}
-> (C) {"command":"setBreakpoints","arguments":{"source":{"name":"Startup.cs","path":"/Users/caseyboyle/Repositories/TrueVelocity/TrueVelocity.Web/TrueVelocity.Web.API/TrueVelocity.Web.API.Admin/Startup.cs","checksums":[{"algorithm":"SHA1","checksum":"ab24777f2aa4e957bcd8794e0aaa6f4f767d945b"},{"algorithm":"SHA256","checksum":"11dd96137695a0c24b41125a237409de127de78024900069e1413fe6bf16cf03"},{"algorithm":"SHA1","checksum":"dd1fc5dffccf73a6f188c8865efbb15320d707e0"},{"algorithm":"SHA256","checksum":"45b578b4a1e99aa705b1931fba2eb38fa72cb50916041e1e0ff3f8126651ad2e"}]},"lines":[21],"breakpoints":[{"line":21}],"sourceModified":false},"type":"request","seq":4}
<- (R) {"seq":7,"type":"response","request_seq":3,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":1,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts.","line":27}]}}
<- (R) {"seq":8,"type":"response","request_seq":4,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":2,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts.","line":21}]}}
-> (C) {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":5}
<- (R) {"seq":9,"type":"response","request_seq":5,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]}}
-> (C) {"command":"setExceptionBreakpoints","arguments":{"filters":[],"filterOptions":[{"filterId":"user-unhandled"}]},"type":"request","seq":6}
<- (R) {"seq":10,"type":"response","request_seq":6,"success":true,"command":"setExceptionBreakpoints","body":{"breakpoints":[{"verified":true}]}}
-> (C) {"command":"configurationDone","type":"request","seq":7}

### C# log ###
None

## Environment information ##

**VSCode version**: 1.62.3
**C# Extension**: 1.23.16

Mono Information
OmniSharp using built-in mono
Dotnet Information
.NET SDK (reflecting any global.json):
Version: 6.0.100
Commit: 9e8b04bbff

Runtime Environment:
OS Name: Mac OS X
OS Version: 11.6
OS Platform: Darwin
RID: osx.11.0-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.100/

Host (useful for support):
Version: 6.0.0
Commit: 4822e3c3aa

.NET SDKs installed:
3.1.402 [/usr/local/share/dotnet/sdk]
3.1.407 [/usr/local/share/dotnet/sdk]
3.1.412 [/usr/local/share/dotnet/sdk]
5.0.201 [/usr/local/share/dotnet/sdk]
5.0.402 [/usr/local/share/dotnet/sdk]
6.0.100 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.18 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.18 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions

|Extension|Author|Version|
|---|---|---|
|aadb2c|AzureADB2CTools|1.3.1|
|application-insights|VisualStudioOnlineApplicationInsights|0.4.2|
|armview|bencoleman|0.4.5|
|auto-close-tag|formulahendry|0.5.13|
|auto-rename-tag|formulahendry|0.1.9|
|azure-account|ms-vscode|0.9.11|
|azure-blueprints-generator|aminecharot|0.1.1|
|azure-pipelines|ms-azure-devops|1.194.1|
|azurecli|ms-vscode|0.5.0|
|azurepolicyextension|AzurePolicy|0.2.2|
|azurerm-vscode-tools|msazurermtools|0.15.5|
|azurite|Azurite|3.14.3|
|beautify|HookyQR|1.5.0|
|csharp|ms-dotnettools|1.23.16|
|csharpextensions|jchannon|1.3.1|
|cypress-snippets|andrew-codes|1.2.0|
|data-workspace-vscode|ms-mssql|0.1.0|
|dendron|dendron|0.69.1|
|dendron-markdown-links|dendron|0.6.20|
|dendron-markdown-preview-enhanced|dendron|0.10.57|
|dendron-markdown-shortcuts|dendron|0.12.1|
|dendron-paste-image|dendron|1.1.0|
|dendron-snippet-maker|dendron|0.1.6|
|docomment|k--kato|0.1.30|
|es7-react-js-snippets|dsznajder|3.1.1|
|file-downloader|mindaro-dev|1.0.11|
|github-vscode-theme|GitHub|5.0.3|
|gitlens|eamodio|11.7.0|
|html-css-class-completion|Zignd|1.20.0|
|jupyter|ms-toolsai|2021.10.1101450599|
|jupyter-keymap|ms-toolsai|1.0.0|
|jupyter-renderers|ms-toolsai|1.0.3|
|markdown-mermaid|bierner|1.13.0|
|material-theme|zhuangtongfa|3.13.2|
|mermaid-markdown-syntax-highlighting|bpruitt-goddard|1.2.2|
|mindaro|mindaro|1.0.120210803|
|msbuild-project-tools|tintoy|0.3.15|
|mssql|ms-mssql|1.11.1|
|ng-template|Angular|13.0.0|
|night-owl|sdras|2.0.1|
|nugetpackagemanagergui|aliasadidev|1.1.9|
|postcss|csstools|1.0.9|
|powershell|ms-vscode|2021.10.2|
|prettier-plus|svipas|4.2.2|
|python|ms-python|2021.11.1422169775|
|remote-containers|ms-vscode-remote|0.205.2|
|rest-client|humao|0.24.5|
|sql-database-projects-vscode|ms-mssql|0.13.1|
|vsc-community-material-theme|Equinusocio|1.4.2|
|vsc-material-theme|Equinusocio|33.2.0|
|vsc-material-theme-icons|equinusocio|1.2.2|
|vscode-apimanagement|ms-azuretools|1.0.3|
|vscode-azureappservice|ms-azuretools|0.23.0|
|vscode-azurecache|ms-azurecache|0.1.0|
|vscode-azureeventgrid|ms-azuretools|0.1.1|
|vscode-azurefunctions|ms-azuretools|1.6.0|
|vscode-azureresourcegroups|ms-azuretools|0.4.0|
|vscode-azureserverlesspack|ms-azuretools|0.1.0|
|vscode-azurestaticwebapps|ms-azuretools|0.9.0|
|vscode-azurestorage|ms-azuretools|0.12.1|
|vscode-azurevirtualmachines|ms-azuretools|0.4.1|
|vscode-bicep|ms-azuretools|0.4.1008|
|vscode-commons|redhat|0.0.6|
|vscode-cosmosdb|ms-azuretools|0.18.1|
|vscode-docker|ms-azuretools|1.18.0|
|vscode-dotnet-runtime|ms-dotnettools|1.4.0|
|vscode-eslint|dbaeumer|2.2.2|
|vscode-html-css|ecmel|1.10.2|
|vscode-icons|vscode-icons-team|11.7.0|
|vscode-kubernetes-tools|ms-kubernetes-tools|1.3.4|
|vscode-logicapps|ms-azuretools|1.0.25|
|vscode-node-azure-pack|ms-vscode|0.2.1|
|vscode-nuget-package-manager|jmrog|1.1.6|
|vscode-pylance|ms-python|2021.11.2|
|vscode-react-native|msjsdiag|1.8.0|
|vscode-tailwindcss|bradlc|0.7.2|
|vscode-tlaplus|alygin|1.5.4|
|vscode-typescript-next|ms-vscode|4.6.20211118|
|vscode-typescript-tslint-plugin|ms-vscode|1.3.3|
|vscode-versionlens|pflannery|1.0.9|
|vscode-yaml|redhat|1.2.0|
|winteriscoming|johnpapa|1.4.4|
|xml|DotJoshJohnson|2.5.1|;

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.