I just wanted to make a (hopefully useful) conclusion here based on all of this discussion. Given what people have tried here and my personal experience teaching HB energy model workflows, it seems very clear that certain versions of OpenStudio are less prone to the PINVOKE error than others.
Notably, @mostapha and I have taught several workshops with OpenStudio 2.4 and we have yet to encounter an PINVOKE error with any of the participants. So this seems to be a more stable version.
All of this said, the discussion here is evidence that some people still experience the PINVOKE error in OpenStudio 2.4 but, for these cases, it seems that OpenStudio 1.14 is able to run without the PINVOKE error.
While this isn’t a perfect solution, it seems like the best that we can offer now until OpenStudio team figures out what is causing this issue.