Studio: Invoke Code error at line -15 (No Compiled Code to Run Error BC31051)

On a blank Invoke Code I get the error "No Compiled code to run error BC31051: Namespace or Type ‘UiPath.MicrosoftOffice365.Activities.SharePoint’ has already been imported. At line -15

In some activities I am getting this error:
Add List Item: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

I reported this previously (Invoke code error at line -3) but the workaround was only temporary and I had to recreate the sequence. This has now happened to me now several times and I don’t want to continue recreating sequences.