Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[From VSTS] Display None as "None" instead of "null" in Data Tips #3716

Closed
cartermp opened this issue Oct 9, 2017 · 8 comments
Closed

[From VSTS] Display None as "None" instead of "null" in Data Tips #3716

cartermp opened this issue Oct 9, 2017 · 8 comments
Labels
Area-Debug stepping, debug points, stacks and more Feature Improvement
Milestone

Comments

@cartermp
Copy link
Contributor

cartermp commented Oct 9, 2017

From here: https://developercommunity.visualstudio.com/content/problem/44030/f-debugging-option-types-returns-null.html

The behavior described is also the same in VS2015 Update 3:

null-vs2015

So this is not a regression.

@dsyme
Copy link
Contributor

dsyme commented Oct 9, 2017

We could only do this with our own debugger engine which was aware of F# types

@dsyme dsyme added Feature Improvement Area-Debug stepping, debug points, stacks and more labels Oct 9, 2017
@cartermp
Copy link
Contributor Author

cartermp commented Oct 9, 2017

@gregg-miskelly just to check - is this another case of "F# needs its own EE"?

@gregg-miskelly
Copy link

Correct

@cartermp
Copy link
Contributor Author

cartermp commented Oct 9, 2017

link #2544

@matthid
Copy link
Contributor

matthid commented Oct 9, 2017

@cartermp cartermp added this to the Unknown milestone Aug 25, 2018
@samuela
Copy link

samuela commented Oct 7, 2018

I just wasted an hour due to this issue.

> printfn "%A" None;;
<null>
val it : unit = ()

> printfn "%A" null;;
<null>
val it : unit = ()

>

Supremely confusing when you're looking at server logs for things that you think should be Options.

@cartermp
Copy link
Contributor Author

cartermp commented Oct 7, 2018

@samuela What you describe is not this issue. This issue is about the representation of None in debugging tools.

What you're observing is thatNone emits as null in IL, which explains why you'd see that as the value in logs. As a remediation, I'd recommend sending all logs through a function that does a check for options, emitting something else for the None case. You can check like this:

let inline isOptionType (t:System.Type) =
    t.GetTypeInfo().IsGenericType && t.GetGenericTypeDefinition() = typedefof<option<_>>

@dsyme
Copy link
Contributor

dsyme commented Aug 24, 2021

Duplicate of #10168

@dsyme dsyme marked this as a duplicate of #10168 Aug 24, 2021
@dsyme dsyme closed this as completed Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Debug stepping, debug points, stacks and more Feature Improvement
Projects
None yet
Development

No branches or pull requests

5 participants