-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Milestone
Description
Version Used:
C# 8.0
Steps to Reproduce:
Apologies if this doesn't quite reproduce here. The origin file is some 3000 lines and the project is probably in the millions.
void ProcessRow(IDataReader reader, ISet<int> questionIds, IDictionary<int, string> visibleExpressions, IDictionary<int, string> enabledExpressions, IDictionary<int, string> completeExpressions)
{
int i = 0;
var questionId = reader.GetInt32(i++);
var dataLevelId = reader[i++] as byte?;
var visibleExpression = reader[i++] as string;
var enabledExpression = reader[i++] as string;
var completeExpression = reader[i++] as string;
if (questionIds.Contains(questionId))
{
if (visibleExpression != null)
visibleExpressions[questionId] = visibleExpression;
if (enabledExpression != null)
enabledExpressions[questionId] = enabledExpression;
if (completeExpression != null)
completeExpressions[questionId] = completeExpression;
}
}
For some reason it wants to use pattern matching but can't understand that i has a different value by that time and the code replacement is non-working code.
We use this indexing idiom here because this loop runs thousands of times per web request and it's very nearly as resilient to schema changes as string indexers and just as easy to read as string indexers and as fast as numeric literal indexers into the data reader. The real code has 18 columns here.
Expected Behavior:
No ... under var as the fix can't be applied here.
Actual Behavior:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Complete
