What's wrong with the following diagram?
Image source: Page 183, NCERT Physics Textbook for Class XII Part I
The reason stated in my textbook is as follows:
Magnetic field lines between two pole pieces cannot be precisely straight at the ends. Some fringing of lines is inevitable. Otherwise, Ampere’s law is violated. This is also true for electric field lines.
I don't understand how is Ampere's law violated when fringe fields are absent.
Can anyone please explain how Ampere's law is violated?