Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Core Web App doesn't break on exception, and no details in exception

I have a new .NET Core 1.0 project, and for some unknown reason it has stopped (or never did, I do not recall) breaking when debugging.

I've added the StackTrace package here: How can I get the line number and file name from an exception in net Core?

But with no success.

I'm using VS2015 community and the standard tooling from there.

A potentially relevant snippet from my project.json file:

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true,
    "define": [ "DEBUG", "TRACE" ]
  },
  "runtimes": {
    "win10-x64": {}
  },
  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

UPDATE

OK, if ou start with a new Core Web Application everything works as expected.

If you then update all the packages, it'll fail to build until you add:

"runtimes": {
    "win10-x64": {},
    "win81-x64": {},
    "win8-x64": {},
    "win7-x64": {},
    "win10-x86": {},
    "win81-x86": {},
    "win8-x86": {},
    "win7-x86": {}
  },

To the project.json to get it to build and launch.

By doing this, I can now get line number but still no breaking. My new test project works as expected. I'll have to go through and see the differences.

like image 524
RemarkLima Avatar asked Nov 11 '16 15:11

RemarkLima


People also ask

How do I enable Break on exception in Visual Studio?

Tell the debugger to break when an exception is thrownIn the Exception Settings window (Debug > Windows > Exception Settings), expand the node for a category of exceptions, such as Common Language Runtime Exceptions. Then select the check box for a specific exception within that category, such as System.

How do I fix unhandled exception in Visual Studio?

On the dialog displayed, uncheck "Exception Settings -> Break when this exception type is user-unhandled". Then, Visual Studio will not stop on this exception.


1 Answers

It appears to be that somehow the exception details were unchecked.

I reset all of the project.json dependencies, which meant I received detailed exceptions on the error pages, however VS still didn't break.

By checking the below:

Exception details window

It's now working correctly. I do not know if that is overkill, and if it's CORE specific, or per project, or something in VS (given a new CORE project did break it makes me think it's per project).

like image 123
RemarkLima Avatar answered Nov 16 '22 03:11

RemarkLima