Closed oudi closed 4 years ago
As I see, you setup 1 bp in WeatherForecastController.cs:29
and breakpoints on all user-unhandled exceptions:
-> (C) {"command":"setExceptionBreakpoints","arguments":{"filters":["user-unhandled"]},"type":"request","seq":5}
after that, you program stopped at bp:
<- (E) {"seq":136,"body":{"allThreadsStopped":true,"description":"","reason":"breakpoint","text":"","threadId":17678},"event":"stopped","type":"event"}
and stackFrames provide you the point in your code:
...
{"column":13,"endColumn":51,"endLine":16,"id":75810467741702,"line":16,"moduleId":"4be45882-5c99-4311-869c-538afae641e4","name":"webapidemo.Program.Main()","source":{"name":"Program.cs","path":"/home/coder/project/webapidemo/Program.cs"}}
...
so, you program stopped at Program.cs line 16.
I updated debugger sources, please, try it.
Thanks for your reply @viewizard , I build the source code and It works perfect!
I debug a .net core webapi application in code-server, set the breakpoint at Controller class. It paused at the breakpoint when i request from browser, but the code not highlight, the Call Stack not show the method either.
In the snapshot, breakpoint set at
var rng = new Random();
From Debug Console log show setBreakpoints sucess
-> (C) {"command":"setBreakpoints","arguments":{"source":{"name":"WeatherForecastController.cs","path":"/home/coder/project/webapidemo/Controllers/WeatherForecastController.cs","checksums":[{"algorithm":"SHA1","checksum":"a5c682ac52a8031e8316527dead42a9d77a5b3ca"},{"algorithm":"SHA256","checksum":"3cd5fc7be889f7ed11dad4727291a7afcbfaf80a91eeea6385948ea044bd298d"},{"algorithm":"SHA1","checksum":"543ac7ce9f0c446b39cc842f78f758fdb9b8a1b9"},{"algorithm":"SHA256","checksum":"532d080bb6470ebe700e4d3ecdd3a33610355f6ebc263ea6e1b70963ecc69bda"}]},"lines":[29],"breakpoints":[{"line":29}],"sourceModified":false},"type":"request","seq":3}
<- (R) {"seq":5,"body":{"breakpoints":[{"id":1,"line":29,"message":"","verified":false}]},"command":"setBreakpoints","request_seq":3,"success":true,"type":"response"}
-> (C) {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":4}
<- (R) {"seq":6,"body":{"breakpoints":[]},"command":"setFunctionBreakpoints","request_seq":4,"success":true,"type":"response"}
-> (C) {"command":"setExceptionBreakpoints","arguments":{"filters":["user-unhandled"]},"type":"request","seq":5}
<- (R) {"seq":7,"body":{"supportsExceptionOptions":false},"command":"setExceptionBreakpoints","request_seq":5,"success":true,"type":"response"}
<- (R) {"seq":8,"body":{},"command":"configurationDone","request_seq":6,"success":true,"type":"response"}
But the stackFrames not contains my code. see the
"seq":139
.<- (E) {"seq":136,"body":{"allThreadsStopped":true,"description":"","reason":"breakpoint","text":"","threadId":17678},"event":"stopped","type":"event"}
-> (C) {"command":"threads","type":"request","seq":13}
<- (R) {"seq":137,"body":{"threads":[{"id":17651,"name":"<No name>"}]},"command":"threads","request_seq":13,"success":true,"type":"response"}
-> (C) {"command":"threads","type":"request","seq":14}
<- (R) {"seq":138,"body":{"threads":[{"id":17651,"name":"<No name>"}]},"command":"threads","request_seq":14,"success":true,"type":"response"}
-> (C) {"command":"stackTrace","arguments":{"threadId":17651,"startFrame":0,"levels":20},"type":"request","seq":15}
<- (R) {"seq":139,"body":{"stackFrames":[{"column":0,"endColumn":0,"endLine":0,"id":75810467741696,"line":0,"moduleId":"4017539b-5ac6-47e1-8acf-385222b96917","name":"System.Threading.ManualResetEventSlim.Wait()"},{"column":0,"endColumn":0,"endLine":0,"id":75810467741697,"line":0,"moduleId":"4017539b-5ac6-47e1-8acf-385222b96917","name":"System.Threading.Tasks.Task.SpinThenBlockingWait()"},{"column":0,"endColumn":0,"endLine":0,"id":75810467741698,"line":0,"moduleId":"4017539b-5ac6-47e1-8acf-385222b96917","name":"System.Threading.Tasks.Task.InternalWaitCore()"},{"column":0,"endColumn":0,"endLine":0,"id":75810467741699,"line":0,"moduleId":"4017539b-5ac6-47e1-8acf-385222b96917","name":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification()"},{"column":0,"endColumn":0,"endLine":0,"id":75810467741700,"line":0,"moduleId":"4017539b-5ac6-47e1-8acf-385222b96917","name":"System.Runtime.CompilerServices.TaskAwaiter.GetResult()"},{"column":0,"endColumn":0,"endLine":0,"id":75810467741701,"line":0,"moduleId":"57b2a5cd-d468-4c19-ba79-131335305fac","name":"Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run()"},{"column":13,"endColumn":51,"endLine":16,"id":75810467741702,"line":16,"moduleId":"4be45882-5c99-4311-869c-538afae641e4","name":"webapidemo.Program.Main()","source":{"name":"Program.cs","path":"/home/coder/project/webapidemo/Program.cs"}}],"totalFrames":7},"command":"stackTrace","request_seq":15,"success":true,"type":"response"}
-> (C) {"command":"continue","arguments":{"threadId":17651},"type":"request","seq":16}
<- (E) {"seq":140,"body":{"allThreadsContinued":true,"threadId":17651},"event":"continued","type":"event"}
<- (R) {"seq":141,"body":{"allThreadsContinued":true,"threadId":17651},"command":"continue","request_seq":16,"success":true,"type":"response"}
<- (E) {"seq":142,"body":{"reason":"exited","threadId":17686},"event":"thread","type":"event"}
I check the log file, there are some Errors
20-07-20 06:48:35 DEBUG > HRESULT ManagedDebugger::GetStackTrace(ICorDebugThread *, int, int, std::vector<StackFrame> &, int &)
20-07-20 06:48:35 ERROR [modules.cpp:351] GetSequencePointByILOffset(info_pair->second.symbols.get(), methodToken, ilOffset, &sequencePoint) : 0x80004005
20-07-20 06:51:54 DEBUG < virtual HRESULT ManagedCallback::CreateThread(ICorDebugAppDomain *, ICorDebugThread *)
20-07-20 06:51:54 DEBUG > virtual HRESULT ManagedDebugger::GetThreads(std::vector<Thread> &)
20-07-20 06:51:54 ERROR [frames.cpp:46] pThread->GetUserState(&corUserState) : 0x80131302
When i create a simple console application, and It works well, so I think the problem only occur in System.Threading.Tasks.Task because it is Asynchronous, the CALL STACK
System.Threading.ManualResetEventSlim.Wait() (Unknown Source:0)
System.Threading.Tasks.Task.SpinThenBlockingWait() (Unknown Source:0)
System.Threading.Tasks.Task.InternalWaitCore() (Unknown Source:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification() (Unknown Source:0)
System.Runtime.CompilerServices.TaskAwaiter.GetResult() (Unknown Source:0)
Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run() (Unknown Source:0)
webapidemo.Program.Main() (\home\coder\project\webapidemo\Program.cs:16)
Environment os: Debian GNU/Linux 10 (x86_64) dotnetcore-sdk: 3.1.302 netcoredbg: latest releas
Reproduce the issue
dotnet new webapi -n webapideom -o webapidemo
in shell.