A student attempts to pass an electrical current through a sample of solid magnesium chloride (MgCl2\text{MgCl}_2MgCl2) and observes no current flow. However, when the sample is heated until it melts, the ammeter registers a significant current.
Explain these observations in terms of the structure and bonding of magnesium chloride.