-
Notifications
You must be signed in to change notification settings - Fork 789
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
Fixes #17438 - Ensure that isinteractive multi-emit backing fields are not public #17439
Conversation
❗ Release notes required
|
I'll test it in 24 hours in all scenarios where it broke for me |
@Szer, thanks mate, that would help. |
checked with snippet below Fails on #r "nuget: Microsoft.ML, 3.0.1"
open Microsoft.ML
open Microsoft.ML.Data
open System.IO
[<CLIMutable>]
type SpamOrHam =
{ [<LoadColumn(0)>]
text: string
[<LoadColumn(1)>]
spam: bool }
let content = """text,spam
abc,spam
123,ham
"""
let tempPath = Path.GetTempFileName()
File.WriteAllText(tempPath, content)
try
MLContext().Data.LoadFromTextFile<SpamOrHam>(tempPath, separatorChar = ',', hasHeader = true)
finally
File.Delete tempPath |
Newtonsoft.Json snippet below works everywhere #r "nuget: Newtonsoft.Json, 13.0.3"
open Newtonsoft.Json
type Foo = { id: int }
{ id = 1 }
|> JsonConvert.SerializeObject
|> fun x -> if x <> """{"id":1}""" then failwith x |
@Szer , thanks this it really helps. Kevin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth adding some sort of IL test for the interactive? I don't think I've been adding support of it to the testing framework though.
I would like to, but we do it in memory. Generating IL would be a touch slower. Perhaps in the future we can consider adding a --testonly:writetofile option to fsi to |
Fixes #17438 - Ensure that isinteractive multi-emit backing fields are not public
dotnet interactive multiemit+ previously made the backing fields for records, unions, E.t.c public, whereas multiemit-makes them internal.
Some poorly written serializers, include public fields specified with a CompilerGeneratedAttribute in the serialization stream.
This means that multiemit**-** has become a work around in scenarios that rely on fsi and serialization using these types of serializers.
This PR fixes the problem by correctly specifying fields as Private (actually internal). As implementation details they are also internal when compiled with realsig**+**
I believe the original reason for making the backing field public was so that fsi could reliably access it from multi-emit assemblies. Due to implementation issues there was previously a limit of 30 internal visible following assemblies. Now that it has been corrected, all multi-emit assemblies in a session have internals visible so, making the fields internal should work correctly.
Todo:
Background:
@Szer
#17308 (comment)
Could you verify that this fix works for your scenario ... I believe it does, but I don't really use ML.net