contents of array parameters must be either readable or writable

Hopefully this might save someone else a little searching. Recently doing some work on C# code to run a NRF24L01+ on a Raspberry Pi 2 when I got this error:

In the Windows Runtime, the contents of array parameters must be either readable or writable. Please apply either System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute or System.Runtime.InteropServices.WindowsRuntime.WriteOnlyArrayAttribute to ‘address’.

this MSDN help here on the ReadOnlyAttributeClass wasn’t all too helpful, similarly the MSDN help here for the WriteOnlyAttributeClass didn’t offer a lot of advice on what this looked like.

Fortunately this MSDN link explained clearly how ReadOnlyAttributeClass or WriteOnlyAttributeClass should be used:

In my case

    public void Configure(byte[] address, byte channel)


   public void Configure([ReadOnlyArray] byte[] address, byte channel)

and all was well again. At least until I got to the next bug.


#iot, #raspberry-pi-2, #windows-10