Error recovery

Follow the discussion at #711.

I'm not sure this is sufficient. We have to wait until type check errors pop up in order to test this. Right now we try to clean the solution and clear FCS cache whenever a weird type check error occurs. Exception filtering could be added later.

I think this PR needs a few iterations before it becomes useful. Please help me test it locally.