Reputation: 585
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?
Upvotes: 7
Views: 3095
Reputation: 563
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:
Upvotes: 13
Reputation: 3332
I had a similar problem: in release build, instead of proper line numbers I was getting line 0
in stack traces; fixed by disabling optimizations; in project.json:
"configurations": {
"Release": {
"buildOptions": {
"optimize": false
}
}
}
Upvotes: 0
Reputation: 585
When I enable portable PDBs in Core framework -> line numbers are back :-)
Enable portable PDBs in project.json:
"buildOptions": {
"debugType": "portable",
...
},
Upvotes: 2