dotnet / dotnet/machinelearning

SchemaDefinition.Create picks up internal fields instead of just public only - affects F#

Open
#6,209 9 comments 1 reaction 0 assignees View on GitHub
area-Core F# needs-further-triage Priority:2
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

This used to work before but now I cannot use CreateFromEnumerable in F# now.

In F#, we define mutable classes by annotating F# 'record' types with CLIMutable:

```F#
[]
type D =
{
Data : float[]
}
```
F# compiler generates IL that looks as follows:

```C#
public class D [ interface list ]
{
internal Data@ = Double[];

public Double[] Data
{
get
{
return Data@;
}
set
{
Data@ = value;
}
}

[ more methods including a default constructor ]
}
```
The SchemaDefinition.Create method picks up both "Data@" and "Data" as fields required by the schema. It should only pickup the public fields.

Please add unit tests for F# as well so these issues are caught earlier.

@dsyme

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.