Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Add nullable annotations to reference assembly #2302

Open

Description

@sbomer

The custom step APIs in the linker's reference assembly should have nullable annotations. When I tried to enable them, ApiCompat produced errors about NullableContextAttribute that I'm not sure how to work around:

error : CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.NullableContextAttribute' exists on 'Mono.Linker.MessageOrigin..ctor(Mono.Cecil.IMemberDefinition, System.Nullable<System.Int32>)' in the contract but not the implementation. [/home/sven/linker/src/linker/Mono.Linker.csproj

I think this is happening because the compiler decides how to emit NullableContextAttribute based on which annotations are most common in a type, which could be different in the ref assembly.

For future reference, we also need to disable CS8597 to prevent warnings about "throw null" in the ref assembly.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions