The problem is that corporate dress codes can no longer rely on good judgment; shorts are absolutely fine at my firm, but we're thinking more cargo/twill/walking shorts and less running/cycling shorts, unless you're in the process of going for a run or a ride. We assume that our people are smart and appropriate and will get ceaselessly mocked by colleagues for bad sartorial choices (we're a gay-owned company of geeks, mostly gay themselves).
I think we can all agree that lycra shorts, for example, would be inappropriate in most office environments, and the rules should make that clear. If shorts are appropriate (leg showing), though, it's completely out of line for someone to comment that there are visible signs of external male genitalia and they must be eradicated at all costs. As a principal in the business, I'd no sooner tell someone what kind of underwear to wear than how to take their coffee.
Visible up-shorts/skirt action is another issue entirely. When Utilikilts started to take off in Seattle, there was a need for one of my colleagues to be gently reminded (OK, teased) to cross his legs and/or arrange his pleats with some care - he's well-hung, and he hadn't worn a skirt-like garment before, and, thus, was giving a Sharon-Stone-esque show once in awhile. I don't care what's worn underneath - I just don't want to see ballsac when you settle in for a meeting.
This is a fine line - you want to please the boss to some extent, but it's not worth the insults to your dignity. Use common sense, keep the goods covered with an appropriate amount of fabric (a good rule is, "Would I wear long trousers made of this to the office), and if she says anything again, ask her to be very clear about what she is objecting to, and how that reconciles with the published standards if applicable.
E