dotnet / dotnet/vscode-csharp

Debugger's Locals & WATCH windows doesn't show the type of JObject for a dynamic field like other types

Open
#1,484 2 comments 0 reactions 0 assignees View on GitHub
Debugger Debugger-Poachable OmniSharp
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
18h 40m
Merged PRs (30d)
31

Description

## Environment data
`dotnet --info` output:
```
.NET Command Line Tools (1.0.1)

Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40cd1

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin
RID: osx.10.11-x64
Base Path: /usr/local/share/dotnet/sdk/1.0.1
```
`VS Code version`: 1.12.1
`C# Extension version`: 1.8.1

## Steps to reproduce
1. Create the following code as
```C#
[HttpPatch("{test2")]
public async Task PatchTest(
[FromBody] JsonPatchDocument patch
)
{
A a = new A {
Name = "John",
Dyn = new System.Dynamic.ExpandoObject()
};
a.Dyn.oId = "oId123";
a.Dyn.pId = "pId123";

patch.ApplyTo(a);
return Ok(a);
}

public class A {
public string Name {get; set;}
public dynamic Dyn {get; set;}
}
```
2. Run and debug it, and sent a HTTP request with the below `application/json` body from Postman to it
```json
[
{ "op": "replace", "path": "/Dyn", "value": {
"aId": "aId123",
"bId": "bId123"
}
}
]
```

3. Observe the variable `a` in the debugger's `Locals` window. Before `patch.ApplyTo(a);` it shows the type of `a.Dyn` as `{System.Dynamic.ExpandoObject}` **_which is nice_** as I wanna know the real type here.
![image](https://cloud.githubusercontent.com/assets/19678455/26083775/c386fe72-3a2b-11e7-8b44-b06c10280442.png)

4. After `patch.ApplyTo(a);`, the a.Dyn's value has been replaced by a `{Newtonsoft.Json.Linq.JObject}` which is created by `Microsoft.AspNetCore.JsonPatch.JsonPatchDocument`, it doesn't show the type of `a.Dyn` instead shows the value of it, **_which isn't that convenient_** as the type info is very important.
![image](https://cloud.githubusercontent.com/assets/19678455/26083943/a8fa3924-3a2c-11e7-81b8-81145392a0b8.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.