So I’m in the process of writing a couple classes that wrap a stream interface driver. Specifically I’m writing a class for a PCA9555 I2C chip, which inherits from a generic I2C class that inherits from the StreamInterfaceDriver class. I come the the Read function and I realize that as the data parameter I have to pass a byte array, but the actual driver I’m talking to wants this to be a structure. To make it more fun the structure contains a pointer to a byte array, so the struct is 16 bytes, 4 of which are a pointer to an array of unmanaged data.
To make a long story short, I ended up writing a new Read function in the I2C class that hides the base version so I can manage the unmanaged data. Well I then needed to call the FileEx.ReadFile function, which needs a port handle. The handle is a private member of StreamInterfaceDriver – oops, guess I didn’t consider this in my original base class design. Fortunately the SDF is shared source, so time from bug detection to when the publicly available code was fixed (making it protected) was about 2 minutes.
If you’ve got customers concerned about using 3rd-party libraries I’d think examples like this would help ease their fears.