Officers have described the incident on the A76 on Saturday night at 11.55 pm as ‘extreme reckless conduct’.
And they say it could have killed someone.
The Skoda Rapid taxi was travelling north, just past the McDonalds roundabout, when a large stone was thrown onto the bonnet of the car, damaging it.
Constable Bruce Kemp at Dumfries said: “I cannot believe the stupidity of anyone carrying out such a reckless act. This could have caused serious injury or even death if the car driver had lost control of his vehicle. The taxi was carrying passengers at the time.
“We want to hear from anyone who may be able to help us catch those responsible for this reckless act.” Callers can contact police on the 101 number.