Author |
Topic |
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Sep 08 2020 : 10:17:25 AM
|
I definitely do understand that its hard to suggest an item but at least the type would be really nice to get right.
here, the only symbols that can be inserted would be "new SerialNumber" or "sn1" or null. The definition of ForceReset is:public static SerialNumberReset ForceReset(SerialNumber sn);
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Sep 08 2020 : 11:08:29 AM
|
Does VA know / understand the type of "_project"? I see it as a parameter above, and it is in bold, suggesting a local variable, so VA should know what this is, and that it does not match the type for this function parameter. |
zen is the art of being at one with the two'ness |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Sep 08 2020 : 11:16:01 AM
|
Definitely does, _project is a class member, as is _machine. sng is of type SerialNumberGenerator. (actually on this shot I am using the static method like a instance method, but after correcting this the result was the same, just in case anyone wonders) |
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Sep 08 2020 : 11:28:19 AM
|
I have tried the following very simple test case, can you try the following code, just to see if you get a reasonable VA listbox please:
namespace uniwares_testing
{
class SerialNumber
{
public int projectReference { get; set; }
public int internalNumber { get; set; }
public SerialNumber GenerateSerialNumber(int _project, SerialNumber baseNumber)
{
SerialNumber newNumber = new SerialNumber();
newNumber.projectReference = _project;
newNumber.internalNumber = baseNumber.internalNumber + 1;
return newNumber;
}
public void ForceReset(SerialNumber sn)
{
sn.internalNumber = -1;
}
}
class testUsingSerialNumber
{
void simpleTest()
{
SerialNumber sng = new SerialNumber();
int _project = 2;
// Test - type "(" after "ForceReset" on the line below to get VA listbox
sng.ForceReset;
}
}
} I need to work out / look up how to get a function that takes a Lambda expression as a parameter to get a better test, but this is a start point.
I wonder if the problem is because we are inside the Lambda statement, but if so, why is VA confused by a function call on "sng" when this is being shown in bold as a local variable... rather strange. |
zen is the art of being at one with the two'ness |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Sep 08 2020 : 11:32:24 AM
|
|
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Sep 08 2020 : 11:36:48 AM
|
For the lambdas parameters you define the method like this:
public void MyMethod(int inparameter, Action<LambdaParameterType> lambdaexpression); this gives you:
MyMethod(10, lpt => { if(lpt is LambdaParameterType) ... ;} );
Thats just one of the many methods... |
|
|
feline
Whole Tomato Software
United Kingdom
19025 Posts |
Posted - Sep 10 2020 : 12:07:44 PM
|
I have worked out a simple test case here, that seems to capture the situation you have. At 150 lines of C# its a bit big for a forum post, so I have emailed you my test solution, can you please have a look when you get it, and let me know if I am testing the right thing or not here:
case=142860 |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|