{"action":"created","issue":{"url":"https://api.github.com/repos/OmniSharp/omnisharp-vscode/issues/1582","repository_url":"https://api.github.com/repos/OmniSharp/omnisharp-vscode","labels_url":"https://api.github.com/repos/OmniSharp/omnisharp-vscode/issues/1582/labels{/name}","comments_url":"https://api.github.com/repos/OmniSharp/omnisharp-vscode/issues/1582/comments","events_url":"https://api.github.com/repos/OmniSharp/omnisharp-vscode/issues/1582/events","html_url":"https://github.com/OmniSharp/omnisharp-vscode/issues/1582","id":237685943,"number":1582,"title":"Debugger cannot display callstack for exception thrown from \"async\" method","user":{"login":"llint","id":8145210,"avatar_url":"https://avatars3.githubusercontent.com/u/8145210?v=3","gravatar_id":"","url":"https://api.github.com/users/llint","html_url":"https://github.com/llint","followers_url":"https://api.github.com/users/llint/followers","following_url":"https://api.github.com/users/llint/following{/other_user}","gists_url":"https://api.github.com/users/llint/gists{/gist_id}","starred_url":"https://api.github.com/users/llint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llint/subscriptions","organizations_url":"https://api.github.com/users/llint/orgs","repos_url":"https://api.github.com/users/llint/repos","events_url":"https://api.github.com/users/llint/events{/privacy}","received_events_url":"https://api.github.com/users/llint/received_events","type":"User","site_admin":false},"labels":[{"id":335241425,"url":"https://api.github.com/repos/OmniSharp/omnisharp-vscode/labels/Debugger","name":"Debugger","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-21T22:47:15Z","updated_at":"2017-06-27T00:38:39Z","closed_at":null,"body":"## Environment data\r\n`dotnet --info` output:\r\n```\r\n.NET Command Line Tools (1.0.1)\r\n\r\nProduct Information:\r\n Version:            1.0.1\r\n Commit SHA-1 hash:  005db40cd1\r\n\r\nRuntime Environment:\r\n OS Name:     Mac OS X\r\n OS Version:  10.12\r\n OS Platform: Darwin\r\n RID:         osx.10.12-x64\r\n Base Path:   /usr/local/share/dotnet/sdk/1.0.1\r\n```\r\nVS Code version: `1.13.1`\r\nC# Extension version: `1.10.0`\r\n\r\n## Steps to reproduce\r\n\r\n1. Create a new dotnet console project, restore it normally, and have it open under visual studio code, and consent to add C# debugging support for the project inside VSC.\r\n\r\n2. Replace the generated `Program.cs` with the code below\r\n\r\n        using System;\r\n        using System.Threading.Tasks;\r\n\r\n        namespace ExceptionTest\r\n        {\r\n            class Program\r\n            {\r\n                static async Task TestException()\r\n                {\r\n                    await Task.Delay(1000);\r\n                    throw new Exception(); // the debugger is paused, but no callstack information is available\r\n                }\r\n\r\n                static void Main(string[] args)\r\n                {\r\n                    // throw new Exception(); -- nicely caught by debugger with full callstack\r\n\r\n                    TestException().Wait();\r\n                }\r\n            }\r\n        }\r\n\r\n3. Make sure \"User-Unhandled Exceptions\"is ticked, leaving \"All Exceptions\" unticked\r\n\r\n4. Start debugging through the debug menu within VSC\r\n\r\n\r\n## Expected  behavior\r\nWhen debugging under the debugger, the exception thrown from within `TestException` should pause the debugger, and full stack information should be shown, as well as the file/line information, and local variables, etc..\r\n\r\n## Actual behavior\r\nWhen debugging under the debugger, the debugger is paused due to the exception thrown within `TestException`, but no callstack information can be found through the debugger displays, except that only two threads (on my Mac) are shown, but lacking the stack information for each thread."},"comment":{"url":"https://api.github.com/repos/OmniSharp/omnisharp-vscode/issues/comments/311219879","html_url":"https://github.com/OmniSharp/omnisharp-vscode/issues/1582#issuecomment-311219879","issue_url":"https://api.github.com/repos/OmniSharp/omnisharp-vscode/issues/1582","id":311219879,"user":{"login":"gregg-miskelly","id":11078489,"avatar_url":"https://avatars3.githubusercontent.com/u/11078489?v=3","gravatar_id":"","url":"https://api.github.com/users/gregg-miskelly","html_url":"https://github.com/gregg-miskelly","followers_url":"https://api.github.com/users/gregg-miskelly/followers","following_url":"https://api.github.com/users/gregg-miskelly/following{/other_user}","gists_url":"https://api.github.com/users/gregg-miskelly/gists{/gist_id}","starred_url":"https://api.github.com/users/gregg-miskelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregg-miskelly/subscriptions","organizations_url":"https://api.github.com/users/gregg-miskelly/orgs","repos_url":"https://api.github.com/users/gregg-miskelly/repos","events_url":"https://api.github.com/users/gregg-miskelly/events{/privacy}","received_events_url":"https://api.github.com/users/gregg-miskelly/received_events","type":"User","site_admin":false},"created_at":"2017-06-27T00:38:39Z","updated_at":"2017-06-27T00:38:39Z","body":"@llint your expected behavior isn't something that is possible.  *Short summary*: exceptions thrown from an async method which returns a Task are not considered 'user unhandled'. \r\n\r\n*Explanation (if you care why)*: There is a design flaw, from a tooling perspective (its good in other ways), with System.Task. That flaw is that it is common for callers of an async method to not have signed up to listen for the result of that async method at the time that said async method starts executing asynchronously. This makes it impossible to decide, at the time an exception is thrown from an async method, if any user code will wind up handling that exception.\r\n\r\nNow what the behavior you should see is that the debugger stops on the unhandled exception in your program - your call to `Wait()` in Main. This is something that the VS Code team fixed recently (https://github.com/Microsoft/vscode/issues/27903). This results in a far less confusing behavior in current insiders builds (see screen capture at the end). From there you can evaluate `$exception.InnerException.StackTrace` to see where the exception is from.\r\n\r\nIn addition, there two other remaining issues:\r\n* https://github.com/OmniSharp/omnisharp-vscode/issues/1007: We currently do NOT display any information about the inner exception in the exception peak window (unlike in Visual Studio). I am hoping we can provide that.\r\n* https://github.com/OmniSharp/omnisharp-vscode/issues/1593: Things are currently pretty broken for .NET Core 2.0 it seems.\r\n\r\n![current-insiders-behavior](https://user-images.githubusercontent.com/11078489/27565388-e524b13c-5a92-11e7-88fb-ec2329a23bde.png)\r\n"}}
{"actor":{"display_login":"gregg-miskelly"}}