JSON validation failed for IncludeScopes in appsettings.json

Viewed 1379

I'm using ASP.NET Core 2.1.

Why am I getting Expression must be of type object for IncludeScopes in my appsettings.json file?

enter image description here

Here's a simplified version of the JSON needed to show the warning. To reproduce this, you just need to create a blank ASP.NET Core project and update appsettings.json:

{
  "Logging": {
    "IncludeScopes": false,
    "Debug": {
      "LogLevel": {
        "Default": "Warning"
      }
    },
    "Console": {
      "LogLevel": {
        "Default": "Warning"
      }
    }
  },
  "serilog": {
    "write-to": {
      "sumologic.url": "http://localhost",
      "RollingFile.pathFormat": "R\\Document\\API\\Logs-{Date}.log"
    }
  }
}
1 Answers

As the github issue said, you add the IncludeScopes to the wrong level. Change like below:

{
  "Logging": {
    "Console": {
      "LogLevel": {
        "Default": "Warning"
      },
      "IncludeScopes": false
    },
    "Debug": {
      "LogLevel": {
        "Default": "Warning"
      }
    }
    
  },
  "serilog": {
    "write-to": {
      "sumologic.url": "http://localhost",
      "RollingFile.pathFormat": "R\\Document\\API\\Logs-{Date}.log"
    }
  }
} 
Related