I went to a friend's wedding last night. It was a formal wedding. One of the other guests showed up in a pair of knit Bermuda/ walking shorts and a cropped, off the shoulder tee shirt. She knew the venue was fancy and she knew it was a formal wedding. Her disrespect toward the bride at not even pretending to care astounds me.
I wouldn't actually give a dress code, but serious people should know you don't attend a wedding in gym clothes.