-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-IDEResolution-FixedThe bug has been fixed and/or the requested behavior has been implementedThe bug has been fixed and/or the requested behavior has been implementeduntriagedIssues and PRs which have not yet been triaged by a leadIssues and PRs which have not yet been triaged by a lead
Milestone
Description
Version Used:
Version 17.9.0 Preview 3.0 [34431.11.main]
Steps to Reproduce:
using System.Runtime.CompilerServices;
Console.WriteLine("Hello, world!");
internal struct Repro
{
private Values _values;
public void Populate()
{
Span<int> values = _values;
for (int i = 0; i < values.Length; i++)
{
values[i] = i;
}
}
}
[InlineArray(4)]
internal struct Values
{
#pragma warning disable IDE0044 // Add readonly modifier
#pragma warning disable IDE0051 // Remove unused private members
private int _field;
#pragma warning restore IDE0051
#pragma warning restore IDE0044
}Expected Behavior:
No diagnostic on Populate.
Actual Behavior:
IDE0251 is raised on Populate to mark it as readonly. But you can't mark it as readonly; if you do, that then triggers an error on the casting of _values: "error CS9164: Cannot convert expression to 'Span' because it is not an assignable variable"
ufcpp and AlgorithmsAreCool
Metadata
Metadata
Assignees
Labels
Area-IDEResolution-FixedThe bug has been fixed and/or the requested behavior has been implementedThe bug has been fixed and/or the requested behavior has been implementeduntriagedIssues and PRs which have not yet been triaged by a leadIssues and PRs which have not yet been triaged by a lead