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

LanguagePrimitives error strings are initialized in default culture before usage in different culture #159

Closed
latkin opened this issue Jan 27, 2015 · 5 comments
Labels
Area-Library Issues for FSharp.Core not covered elsewhere Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. Resolution-Wont Fix

Comments

@latkin
Copy link
Contributor

latkin commented Jan 27, 2015

Ref #141

Some localized error strings in prim-types.fs are declared as module values, which causes them to be statically initialized long before they might be used. This means they might be initialized in a different culture than when they are actually used, which is not desirable.

Fix is to refactor these to be evaluated on-demand.

    try
        Seq.min []
    with e -> 
        printfn "%A" e //use default currentUICulture of process

    // change culture now
    System.Threading.Thread.CurrentThread.CurrentUICulture <- new CultureInfo("it-IT")

    try
        Seq.min []
    with e -> 
        printfn "%A" e // e message is wrong, because is not of 'it-IT' culture
@latkin latkin added the Bug label Jan 27, 2015
latkin referenced this issue Jan 28, 2015
the SR.GetString use CultureInfo.CurrentUICulture, so need to be invoked at
runtime not bound when the module ErrorStrings is opened
@latkin latkin added the fixed label Jan 28, 2015
@latkin latkin closed this as completed Jan 28, 2015
@latkin latkin removed the fixed label Aug 4, 2015
@latkin latkin reopened this Aug 4, 2015
@latkin
Copy link
Contributor Author

latkin commented Aug 4, 2015

Re-opening this one as the fix was rolled back before 4.0

@latkin latkin added this to the F# 4.0 Update 1 milestone Aug 4, 2015
@dsyme dsyme added the pri-3 label Aug 14, 2015
@enricosada enricosada mentioned this issue Oct 21, 2015
@KevinRansom KevinRansom removed the pri-3 label Dec 4, 2015
@dsyme dsyme added Area-Library Issues for FSharp.Core not covered elsewhere Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. labels Jan 8, 2016
@forki
Copy link
Contributor

forki commented Jul 22, 2016

@latkin do you remember why this was rolled back?

@latkin
Copy link
Contributor Author

latkin commented Jul 22, 2016

@forki

#486

#497

@enricosada
Copy link
Contributor

@forki because i changed the function to be lazy loaded. But that was a breaking change for binary api ( these function are inlined inside the compiled assembly ), so assemblies compiled with old fsharp.core but using newer fsharp.core didnt find the functions => runtime crash.

I fixed this issue with #694 , but is should wait for next fsharp.core major version (5?). That's because code compiler with 4.1 will need >= 4.1, and that's not acceptable.
Also the pr has label committed but it's not.
All explained there #694 (comment)

So let's wait fsharp.core 5.0 😄

@cartermp cartermp modified the milestones: F# 4.2, F# 4.0 Update 3 Feb 2, 2017
@dsyme
Copy link
Contributor

dsyme commented May 9, 2017

I'm closing this as Wont Fix. The problem is in practice very minor, and the original fix was rolled back because it would necessitate a breaking change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Library Issues for FSharp.Core not covered elsewhere Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. Resolution-Wont Fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants