I am facing exact same problem as asked here in this question. It's basically the "reading floating values" problem when pull-down resistors are not used.
I am unable to activate pull-down resistors through C# code.I tried various GpioPinDriveMode input modes and the following code, but none of them solved my problem. I still got random inputs from the GPIO pin.
pin.SetDriveMode(GpioDriveMode.InputPullDown);
Is this the wrong way to activate pull-down resistors? How do I do that?
Note that the problem is solved when I physically add a resistor in series. However I would like to use the inbuilt pull-down resistors available in R'pi.