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

VS2013 - Intellisense + Record Types #337

Closed
ghost opened this issue Mar 31, 2015 · 1 comment
Closed

VS2013 - Intellisense + Record Types #337

ghost opened this issue Mar 31, 2015 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented Mar 31, 2015

The problem I have experienced just now is when I am using System.Data.DataTable within a record type like so:

type checkResp = { resp : System.Data.DataTable }

The problem occurs when trying to use this record. It is unusable, intellisense reports that 'resp' is not a record field, and checkResp cannot be used within a type signature, further more hovering over the type name in Visual Studio shows that it is not processed by Intellisense. This leads us to believe there is an error in how the record type, but there is no error anywhere within the record, and strangely, it compiles in FSI fine!

I traced back the problem by trying to use DataTable() elsewhere in my code and seeing a popup saying that I need System.Xml.dll, so I added that reference and suddenly all errors went away. I believe this type of information should be surfaced at the time of defining the record type, as it turned into a 15 minute debug trip for a simple adding of a reference.

@latkin
Copy link
Contributor

latkin commented Mar 31, 2015

Adding a bit more detail on this. If you create a blank F# console app with just below content

type checkResp = { resp : System.Data.DataTable }

let foo (x : checkResp) = ()

You initially get an error due to missing ref to System.Data. Ok, fine.

image

When you add the System.Data reference, now you get cryptic squiggles on the type annotation, and no other obvious errors. What's the deal??

image

When you try a full compile, finally you see an error that indicates you need a reference to System.Xml

image

Note that the file/line for that error are dummy values, which is why you don't get squiggles. Also note that if you do go add the System.Xml reference, the compile succeeds but the resulting binary doesn't even reference System.Xml

This is a long-standing usability bug that's been kicking around internally since at least 2012. IIRC the compiler is a bit too aggressive about requiring transitive closure of referenced assemblies.

It works in FSI because System.Xml is in the list of assemblies referenced by default in interactive sessions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants