Input code
public struct Pair
{
public int First;
public int Second;
public Pair(int value)
{
First = value;
Second = First + 1;
}
}
Erroneous output
public struct Pair(int value)
{
public int First = value;
public int Second = First + 1;
}
This does not compile:
error CS0236: A field initializer cannot reference the non-static field, method, or property 'Pair.First'
The constructor should remain explicit because the second assignment depends on an instance field initialized by the first assignment.
Details
Product: ICSharpCode.Decompiler / ilspycmd.
Version: master 2efd871.
The input was compiled in Release for net10.0.
I can submit a small fix and regression test.
Input code
Erroneous output
This does not compile:
The constructor should remain explicit because the second assignment depends on an instance field initialized by the first assignment.
Details
Product: ICSharpCode.Decompiler / ilspycmd.
Version: master
2efd871.The input was compiled in Release for
net10.0.I can submit a small fix and regression test.