I'd agree with the masonry bit (as well, stucco is rough on drill bits anyway) of whatever size is recommended for the wall anchors you're using.
I'd been reluctant to post a response, as I had no idea what do do for the wall without flattening down that section, but I have a completely untested idea --
If the stucco isn't too extreme in its texture, and you're not going to be putting lots of load on the shelf, you might be able to cut a piece of foam to use as backing, and then tighten it to the wall to compress the foam so it's not too bouncy. You're likely going to want extra (or heavier) bolts for this; there won't be friction against the wall, so the bolts are going to be taking the whole load in sheer. Also, you won't have the same support against moment.
I was thinking some of the stiffer spray-foam might work, but if you wanted to make it removable without damage (and if you didn't, you'd just flatten the wall), you'd need to add some release agent, which might stain the wall, or go through some hoops to pull this off:
- Make a frame the size of the bracket, open on the side against the wall, and an extra hole (see below).
- Figure out where you want to mount the bracket.
- Tape a plastic bag large enough to full the frame on the end of a can of spray foam.
- Stuff the bag in the frame through the hole.
- Hold the frame where you want to mount the bracket, and inject the spray foam.
- Wait for it to set up.
- Repeat steps 2 through 6 for each additional bracket location.
You might be able to do something similar with other products to mold to the wall, but all of the ones I can think of have slower set times which would make it really slow going.
As Legion600 suggested, you probably have steel studs as furring strips. You need to be sure you are not hitting protection plates installed on wood studs.
![cable protection plate](https://i.stack.imgur.com/eu5Oq.jpg)
These protect electrical or plumbing lines close to the stud face, and you must never attempt to drill through these. Usually, if you drill several inches above or below such plates, you will hit wood. If you are hitting metal along the entire stud length, it is not a protection plate, but a metal stud. Metal studs in this application should be fairly light gauge and easy to drill through. Protection plates are about 16 GA and are not easy to drill through.
You may anchor objects to metal studs. They are sturdy enough when finish sheathing is attached along their length. Do not use toggles, the hole required is too large. It's best to use a number of self-drilling screws that are barely long enough to engage the stud face material after passing through the mount and wall finish. This avoids damaging any lines routed through the center holes of the stud. You can also use self tapping screws into pre-drilled holes, but drill very carefully so as not to damage any underlying lines when the drill breaks through the face material, and again, use appropriate length screws.
Best Answer
Judging by the thickness and location of the metal you detected it seems like you might have metal drywall corner bead, which is typically installed on the edges of drywall to reinforce the area and prevent chipping.
Assuming that is what you found, the corner bead shouldn't interfere with the installation of shelves. That doesn't mean there isn't anything else behind the drywall that the stud detector isn't picking up, so proceed with care.