DefaultParameterValue null does not create the expected TLB
Closed this issue · 1 comments
SOsterbrink commented
With the following code example:
public void MyMethodName(int param1, [DefaultParameterValue(1)] int param2);
public void MyMethodName2(IDemoInterface param1, [DefaultParameterValue(null)] IDemoInterface? param2);
public void MyMethodName3(IDemoInterface param1, IDemoInterface? param2 = null);
The first and third options to set a default value work as expected.
But the second option will ignore the default value.
This happens only if the provided default value is not optional and null
SOsterbrink commented
Preliminary suggestion for a workaround:
Use version 3) or 1) with any value that is not null
Further analysis of the problem is ongoing.