title: Application Insights - ILogger arguments rendered as name of the object in custom dimensions
body: <p>Objects are rendered as strings, (name of the object), in Application Insights custom dimensions when passed as arguments to ilogger. The actual values are not shown.</p>
  
  <p><strong>Register Application Insights</strong></p>
  
  <pre><code>services.AddApplicationInsightsTelemetry();
  </code></pre>
  
  <p><strong>New log</strong></p>
  
  <pre><code>public class HealthController : ControllerBase
  {
      private readonly ILogger&lt;HealthController&gt; _logger;
  
      public HealthController(ILogger&lt;HealthController&gt; logger)
      {
          _logger = logger;
      }
  
      [HttpGet]
      public IActionResult Get()
      {
          var health = new HealthViewModel()
          {
               ok = false
          };
  
          _logger.LogInformation("Hlep me pls {health}", health);
  
          return Ok(health);
      }
  }
  </code></pre>
  
  <p><strong>Result</strong></p>
  
  <p><a href="https://i.stack.imgur.com/tt1OU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tt1OU.png" alt="enter image description here"></a></p>
  
  <p>I do not want to this this for every log:</p>
  
  <pre><code>var health = new HealthViewModel()
  {
       ok = false
  };
  
  _logger.LogInformation("Hlep me pls {health}", JsonConvert.SerializeObject(health));
  </code></pre>
  
  <p>I tried creating a middleware for application insights but the value is still the name of the object..</p>
  
  <p><a href="https://i.stack.imgur.com/qtEMW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qtEMW.png" alt="enter image description here"></a></p>
  
  <h2>Why are arguments not rendered as json?</h2>
  
  <p><strong>Edit</strong></p>
  
  <p>It seems like </p>
  
  <pre><code>var health = new
  {
       ok = false
  };
  
  _logger.LogInformation("HEJ2 {health}", health);
  </code></pre>
  
  <p>works but not</p>
  
  <pre><code>var health = new HealthViewModel
  {
       ok = false
  };
  
  _logger.LogInformation("HEJ2 {health}", health);
  </code></pre>