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

New option for runtime/compiler nullable context check. C# 8.0 #554

Open
VISTALL opened this issue Jul 26, 2020 · 3 comments
Open

New option for runtime/compiler nullable context check. C# 8.0 #554

VISTALL opened this issue Jul 26, 2020 · 3 comments

Comments

@VISTALL
Copy link
Member

VISTALL commented Jul 26, 2020

Need option for UI too.

Initial from #553

CS8632=The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

-nullable[+|-]                Specify nullable context option enable|disable.
-nullable:{enable|disable|warnings|annotations}
                              Specify nullable context option enable|disable|warnings|annotations.

Also need load this option from bytecode

System.Runtime.CompilerServices.NullableContextAttribute

namespace System.Runtime.CompilerServices
{
    [System.AttributeUsage(
        AttributeTargets.Module |
        AttributeTargets.Class |
        AttributeTargets.Delegate |
        AttributeTargets.Interface |
        AttributeTargets.Method |
        AttributeTargets.Struct,
        AllowMultiple = false,
        Inherited = false)]
    public sealed class NullableContextAttribute : Attribute
    {
        public readonly byte Flag;
        public NullableContextAttribute(byte flag)
        {
            Flag = flag;
        }
    }

    public enum NullableMembers
    {
        Public = 0,   // public and protected only
        Internal = 1, // public, protected, internal
        All = 2,
    }

    [System.AttributeUsage(AttributeTargets.Module, AllowMultiple = false)]
    public sealed class NullableMembersAttribute : Attribute
    {
        public readonly NullableMembers Members;
        public NullableMembersAttribute(NullableMembers members)
        {
            Members = members;
        }
    }
}
@VISTALL VISTALL self-assigned this Jul 26, 2020
@VISTALL VISTALL changed the title New option for runtime/compiler context check New option for runtime/compiler nullable context check. C# 8.0 Jul 26, 2020
@VISTALL
Copy link
Member Author

VISTALL commented Jul 26, 2020

Also new options was added to MSBuild, like NullableContextOptions + Nullable

@VISTALL
Copy link
Member Author

VISTALL commented Jul 27, 2020

Also new processor directive

#nullable enable

#nullable restore

VISTALL added a commit that referenced this issue Jul 30, 2020
add UI option for nullable

support #nullable

impl CS8632

migrate to localize from bundle
@VISTALL VISTALL mentioned this issue Jul 30, 2020
@VISTALL
Copy link
Member Author

VISTALL commented Aug 2, 2020

Also

System.Runtime.CompilerServices.NullableAttribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant