Perpetual machine from a PN-junction diode
This circuit has three dissimilar materials: two doped semiconductor
regions, and a wire (we can allow
the resistor to be a wirewound type, so it's just... part of the wire).
That means there are three junctions.   While the metal joints are perhaps not
semiconductor diodes, they ARE subject to the same charge-diffusion
boundaries at the joint, and even between metals, there is a
known effect (thermocouple or Seebeck effect) due to charge migration
at that boundary.
So, the total circular sum of voltages across those three junctions
might be zero, but none of the individual junctions is exactly zero
voltage.   In fact, if the joints are at different
temperatures, you'll get a net thermocouple effect, and current
may flow through the resistor.   It's a heat engine, though,
and  not a perpetual motion solution.
The metallurgy of making a metal joint to a semiconductor is a significant problem, and the easy solutions (for silicon, an aluminum interface layer)
are  often unappreciated.