The barrel-shaped “pupa” of a fly ( not of a midge: midges generally have a true pupa). It merits a word for its own because, although it looks like a pupa, it essentially is the last dried larval skin, with the true pupa inside. Only at rare occasions it is possible to see the real pupa within the puparium: foto below.
Phytomyza agromyzina: pupa; in the background the remnant of the puparium.
Also the final larval stage of whiteflies, Aleyrodidae, is generally addressed as puparium. It is oval, flattened, and attached to the plant.