\u3cp\u3eIn many industrial processes, a large proportion of energy is lost in the form of heat. Thermoelectric generators can convert this waste heat into electricity by means of the Seebeck effect. However, the use of thermoelectric generators in practical applications on an industrial scale is limited in part because electrical, thermal, and mechanical bonding contacts between the semiconductor materials and the metal electrodes in current designs are not capable of withstanding thermal-mechanical stress and alloying of the metal-semiconductor interface when exposed to the high temperatures occurring in many real-world applications. Here we demonstrate a concept for thermoelectric generators that can address this issue by replacing the metallization and electrode bonding on the hot side of the device by a p-n junction between the two semiconductor materials, making the device robust against temperature induced failure. In our proof-of-principle demonstration, a p-n junction device made from nanocrystalline silicon is at least comparable in its efficiency and power output to conventional devices of the same material and fabrication process, but with the advantage of sustaining high hot side temperatures and oxidative atmosphere.\u3c/p\u3