This points out the need for understanding the basics of wiring. The light fixture must have a neutral from the house connected to the neutral on the fixture, and will have a switched hot from the switch box connected to the hot connection of the fixture.
The neutral from the house wiring will always be white. If the fixture has wire leads, the fixture neutral will always be white so the neutral connection to the fixture will always be white to white.
The switched hot from the switch however can be either black or white. Therefore, the connection to the hot lead on the fixture can be either black to black or white to black. When a white wire is used as a hot or a switched hot it is supposed to be marked with black tape or a black marker around each end.
There are two ways the house wiring can power a ceiling fixture controlled by a wall switch:
(1) The cable from the house (black always hot, white neutral) goes into the switch box. The black line hot connects to one side of the switch. The white neutral connects to the white of a cable going to the ceiling box.
In the ceiling box the black wire is switched hot and connects to the black lead, and the white is neutral and connects to the white neutral lead of the fixture.
(2) The cable from the house enters in the ceiling fixture box. In the old wiring method the white neutral connected directly to the white neutral of the fixture and stopped there. The black line hot was connected to either the black or the white of a cable with only black and white going to the switch box. The other wire of the cable was connected to the black lead ofvthe fixture.
In the switch box the two wires (one black and one white were connected respectively to the two contacts on the switch so the white wire either carried the line hot to the switch or the switched hot to the fixture. In this arrangement there was no neutral in the switch box which was OK because the simple mechanical switch did not need one.
Nowadays it is required to have a neutral in the switch box (new construction only) so if the line hot enters in the ceiling, then a three conductor cable (black, red, white) would be required between the ceiling fixture box and the wall switch. The white would be neutral, and the red and black would carry the hot and the switched hot and be connected to the two connections on the switch.
The white neutral would only be connected to the switch if the switch was one which consumed power, e.g., an electronic timer or a smart switch.