Confusing regarding measuring barrier potential of a pn junction using a voltmeter
The physics stackexchange answer is wrong.   He does get it right about Fermi level.  But he completely misunderstands the nature of that "galvani" potential versus "voltage."   There is no mystery: they are the same thing.   An ideal voltmeter would happily measure the built-in potential across an unconnected PN junction, no current needed.  It's a real voltage, just like the voltage between charged capacitor plates.

The problem is that (guess!) if you touch some metal voltmeter probes against silicon, a Schottky voltage appears at the two new junctions!  Don't ignore the copper-silicon junctions where the voltmeter's probes make contact.

The built-in voltage at the PN junction is perfectly real.   It's not some sort of weird ghostly magical unmeasurable thing.   The problem is that real voltmeters are made of copper (or brass/tin/etc. choose your metal.)   When touched against doped semiconductor, the voltmeter's wires create two new junction-voltages at the metal-silicon connections.  These two new built-in voltages will be in the opposite direction of the pn junction voltage.  So, a real voltmeter cannot get to the PN junction to measure it.  The tin-plated-copper probes get in the way.   But an ideal voltmeter (a potential-detector, perhaps a spinning FET gate, or a voltage-sensitive optical fiber) wouldn't create these unwanted contact-potentials.  To get at the pn junction voltage, we need a non-contact voltmeter, as well as an infinite-impedance meter, or at least one with picoamps leakage.  These aren't impossible, just expensive.   The static pn potential isn't impossible to measure, just difficult.  Your DVM can't do it; you need some sort of moving-probe electrometer.   Or, just spin a small PN junction device at high speed and measure the AC voltage in the surrounding space!  A PN junction is a permanently-charged capacitor.

Note that if we touch copper against steel, or against tin, brass, silicon, etc., we always create a voltage across the junction, even if we don't create a diode.  Iron welded or bolted against copper gives a junction-voltage, but if we try to extract energy from this, we'll need to connect some copper-iron together at another point, to form a circuit.  The two voltage-drops are in opposite directions, copper-iron versus iron-copper.  The sum is zero and the current is zero.  (No perpetual motion device, whaaa, too bad.)  The copper and iron are genuinely charged up by simple contact, and have significant voltage between them.  But it's not an energy source.

Yet doesn't this iron-copper junction sound familiar?  You guessed it: that's how thermocouples actually work.   Thermocouples don't generate microvolts.   Instead, voltage already exists between the two metals in the thermocouple circuit (a familiar voltage difference.) Then, if we change the temperature of just one of the two contact-points, then the voltages across each of two different points won't be the same (a difference between two separate voltage-differences.)  It's this imbalance between the two opposing voltages that's read by the meter in the thermocouple circuit.  (Or, we could short it out completely, then read the short-circuit current.)   Yet if the two temperatures are made the same and the meter reads zero, the iron side is still charged negatively like a capacitor plate, and the copper charged positive.[*]   Metal junctions are charge pumps much like batteries.   Any imbalance at one of the junctions, and a huge current can appear when the circuit is closed.   The imbalance can be temperature, or incoming light, or differences in active corrosion where metal touches conductive water.  All of these do offer an energy source, even though the simple copper-iron (or copper-silicon) voltage does not.

Keywords to search:  "nonrectifying junctions."  When attaching wires to a semiconductor block, we want to spoil the junction, so an unwanted diode doesn't form there.   (Think "catswhisker" radio detector.  Some spots on the semiconductor just short out the wire tip.  Others produce a diode effect.  Yet always they give the same metal/semiconductor junction-voltage, rectifying or not.   To hook up the two wires to our pn silicon, we want to use spoiled-catswhisker junctions, non-diode Schottky junctions.)

Notes that a diode is actually three separate thermocouples in series.  But usually they're all at the same temperature, so the copper-silicon junction-voltages add up to exactly cancel the p-n junction voltage.  No voltage appears on the copper leads.   If a diode is connected in a circle (or connected to a microamp meter,) no current appears.   For the three charge-pumps to be imbalanced, we need to heat one spot while cooling another.   That, or shine light on one spot while keeping another dark.

Here's a bit of heresy:  whenever we forward-bias a diode, we reduce the p-n junction-voltage to nearly zero.  In other words, if we detect that reading of 0.7V or whatever, actually we're measuring the copper-p voltage added to the copper-n voltage (since the p-n voltage was mostly eliminated from the picture, once it becomes ~0 and carriers are able to pour across the missing voltage-hill.)   The Vf was never the pn junction voltage!   Instead, it was always the same value as the pn junction voltage, and when we suddenly remove the internal pn junction voltage, the metal-lead junction voltages become visible externally.   Heh, what if diodes were long narrow filaments of silicon, with no metals involved?  Just use the p and the n as the connecting wires?   Same problem: we'd have to connect the "p" filament to the "n" filament somewhere in the circuit, and that exactly opposes the voltage of the original pn diode junction.

[*]I think I got that polarity right.  Need to check it.