Google does/did (AppEngine Java8 can't do that because they do not have any strictness) that in AppEngine, but it is hard and challenging to get right. Especially the security bits.
The Java 8 runtime removed the sandbox restrictions. Most developers hated the restrictions. I highly doubt Microsoft would go down to the path of restrictions given the history in this space.