Skip to content

Go to Metadata - static field handling is wrong #11526

Closed

Description

@cartermp

Navigate to System.Char.

Notice that the MaxValue and MinValue fields are listed as static vals. This is wrong. They cannot just be marked with [<DefaultValue>] either.

image

If we follow the error message you would get if you tried to write this into your own signature, it compiles:

image

But this is no longer correct, since the value in question is a public const field.

Activity

  1. added
    Impact-Medium
    on May 4, 2021
  2. cartermp commented on May 5, 2021

    @cartermp
    ContributorAuthor

    This may be a current limitation in the language, actually. We don't really have a good way to declare these things in F# code today. We can probably still get things to "work" in metadata as source view though, at least getting colors and maybe navigation going.

  3. auduchinok commented on May 5, 2021

    @auduchinok
    Member

    Some context from http://www.ianvoyce.com/index.php/2010/10/01/public-static-fields-gone-from-f-2-0/:

    We deliberately removed the ability to create public static fields in Beta2/RC, because of issues associated with initialization of the fields (i.e. ensuring the “static do” bindings are run correctly, and if they are run, then they are run for the whole file, in the right order, with no deadlocks or uninitialized access when initialization occurs from multiple threads).

  4. added this to the Backlog milestone on Jun 4, 2021
  5. added a commit that references this issue on Jun 9, 2026
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-FCSBugImpact-Medium

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions