Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core missing line numbers in exception

Tags:

asp.net-core

I created new project: ASP.NET Core Web Application (.NET Core) and test throw new exception in controller and catch the exception. In exception is no line numbers (exception.ToString()). I added System.Diagnostics.StackTrace to project.json, but line numbers are still missing, even with debugger.

When I change Core framework project to full .NET framework, line numbers are OK. Can I get line numbers of exception in Core framework?

like image 871
Pavel Jedlicka Avatar asked Nov 11 '16 11:11

Pavel Jedlicka


2 Answers

For me, enabling Portable PDB or setting Optimize didn't fix the problem.

But I tried changing the Debugging information to "Full" in Advanced Build Settings and it worked.

Follow the below procedure:

  1. Open the "Properties" of your startup project.
  2. Goto "Build".
  3. Click on "Advanced" under Output section.
  4. Change the Debugging information to "Full".

enter image description here

like image 197
Vidyesh Avatar answered Nov 15 '22 10:11

Vidyesh


When I enable portable PDBs in Core framework -> line numbers are back :-)

Enable portable PDBs in project.json:

"buildOptions": {
"debugType": "portable",
...
},
like image 40
Pavel Jedlicka Avatar answered Nov 15 '22 10:11

Pavel Jedlicka