Chemical and thermal stability of semiconductors