Skip to content

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

Closed

Description

@latkin

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

Activity

  1. reopened this on Aug 4, 2015
  2. latkin commented on Aug 4, 2015

    @latkin
    ContributorAuthor

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

  3. added this to the F# 4.0 Update 1 milestone on Aug 4, 2015
  4. added
    Area-Library
    Impact-Low
    on Jan 8, 2016
  5. forki commented on Jul 22, 2016

    @forki
    Contributor

    @latkin do you remember why this was rolled back?

  6. latkin commented on Jul 22, 2016

    @latkin
    ContributorAuthor
  7. enricosada commented on Jul 25, 2016

    @enricosada
    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 😄

  8. modified the milestones: , F# 4.0 Update 3 on Feb 2, 2017
  9. dsyme commented on May 9, 2017

    @dsyme
    Contributor

    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

  10. modified the milestones: , F# 4.0 Update 3 on May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-LibraryBugImpact-LowResolution-Wont Fix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions