Skip to content

NullableAttribute Can't Be Emitted #273

@JasonBock

Description

@JasonBock

To reproduce:

  • Rock.Create<TimeProvider>()

That's it. The error is because of the way CreateTimer() is defined:

public virtual ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period)

It's odd because I'm almost positive I've run into this before and handled it, or....not? The issue is I emit [NullableAttribute] for the state parameter in the mock, and this causes CS8623. Looking at GetDescription(), it appears that I don't filter that attribute out, but I'm surprised I haven't seen this error before.

It's possible this is a new diagnostic in .NET 8/C# 12, as this occurred when I targeted .NET 8.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions