#nullable enable
using Rocks;
using System;
[assembly: Rock(typeof(NewNameUsage), BuildType.Create)]
public class NewNameUsage
{
public virtual void Work(string @new) { }
}
Expected behavior
The mock is created with no issues.
Actual behavior
Errors occur:
Error - Id: CS1003, Description: Rocks\Rocks.RockGenerator\NewNameUsage_Rock_Create.g.cs(146,18): error CS1003: Syntax error, ',' expected
Error - Id: CS1003, Description: Rocks\Rocks.RockGenerator\NewNameUsage_Rock_Create.g.cs(146,20): error CS1003: Syntax error, ',' expected
Error - Id: CS1526, Description: Rocks\Rocks.RockGenerator\NewNameUsage_Rock_Create.g.cs(146,18): error CS1526: A new expression requires an argument list or (), [], or {} after type
Additional context
The problem is that the method's parameter uses new for the name and is virtual. Within the override, Rocks puts in a call to the base class method, but it'll do this:
base.Work(new: @new);
What it should do is:
base.Work(@new: @new);
In general, any base invocation should always put @ in front of the parameter name.
This was found on Microsoft.EntityFrameworkCore.Query.Internal.ExpressionTreeFuncletizer
To Reproduce
Expected behavior The mock is created with no issues.
Actual behavior Errors occur:
Additional context The problem is that the method's parameter uses
new
for the name and is virtual. Within the override, Rocks puts in a call to the base class method, but it'll do this:What it should do is:
In general, any base invocation should always put
@
in front of the parameter name.This was found on
Microsoft.EntityFrameworkCore.Query.Internal.ExpressionTreeFuncletizer