Magnetic fields and coronal heating