Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

C# can not find FSharpType.IsRecord in .NET Core #668

Closed
pocketberserker opened this issue Feb 20, 2017 · 3 comments
Closed

C# can not find FSharpType.IsRecord in .NET Core #668

pocketberserker opened this issue Feb 20, 2017 · 3 comments

Comments

@pocketberserker
Copy link

pocketberserker commented Feb 20, 2017

Some FSharpType and FSharpValue methods are defined by F# Type Extensions.
However, C# can not access F# Type Extensions.
And Some methods are not defined in .NET Core( https://github.com/fsharp/fsharp/blob/4.1.0.0/src/fsharp/FSharp.Core/reflect.fsi#L266 ).

Repro steps

  1. dotnet new classlib -lang C# and add <PackageReference Include="FSharp.Core" Version="4.1.0" />.

  2. Call Microsoft.FSharp.Reflection.FSharpType.IsRecoed

Expected behavior

Build succeeded.

Actual behavior

error CS0117: 'FSharpType' does not contain a definition for 'IsRecord'

Related information

sample project: https://github.com/pocketberserker/FSharpNETCoreSandbox/tree/2fdd6fa60cb3989458f96e77a0265064593e9ae7

@pocketberserker pocketberserker changed the title C# can not find FSharpType.IsRecord on .NET Core C# can not find FSharpType.IsRecord in .NET Core Feb 20, 2017
@dsyme
Copy link
Contributor

dsyme commented Feb 20, 2017

@pocketberserker Per CONTIRUBITING.md this should be added as an issue to http://github.com/Microsoft/visualfsharp please. Thanks!

It is unfortunate that C# can't call the methods in FSharpReflectionExtensions just because of the compile names containing a .. This is definitely something we need to fix as it is important for core C# libraries to be able to do this. As a workaround you could call them via reflection I believe?

@pocketberserker
Copy link
Author

@dsyme ok. I'll do that.

I try to use reflection and build succeeded. https://github.com/pocketberserker/FSharpNETCoreSandbox/blob/443c35362cbdd167e59ffea03c535fbc251b212e/CsNETCore/Sandbox.cs#L11
Thank you!

@pocketberserker
Copy link
Author

closing to move to visualfsharp repository

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

No branches or pull requests

2 participants