Closed
Description
openedon May 21, 2024
Version Used: '4.11.0-1.24229.8 (28985c0)'. Language version: 12.0
Steps to Reproduce:
ref struct Sample
{
private ReadOnlySpan<char> _str;
public Sample(ReadOnlySpan<char> str)
{
_str = str;
}
public void MoveNext()
{
var span = _str;
}
}
Use the fix to convert to primary constructor and remove field
ref struct Sample(ReadOnlySpan<char> str)
{
public void MoveNext()
{
// ❌ CS9110 Cannot use primary constructor parameter 'str' that has ref-like type inside an instance member
var span = str;
}
}
Diagnostic Id: IDE0290 Use primary Constructor
Expected Behavior: The code fix is not suggested
Actual Behavior: The code fix is suggested
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Type
Projects
Status
Completed