You wouldn't. The problem is that AC fare codes do not usually map to the same code with their Star Alliance partners (go figure).
AC cleverly changed their web site this year to tell you you get 100% mileage on AC-operated flights (leaving open for interpretation what you get on the codeshare).
The only way we can hope to address this is by bogging AC/AE down - I suggest that every time someone wants to book a codeshare, they first phone Aeroplan and ask how that AC fare code will map over to the partner - explaining along the way that we are donig this because we want to make sure we get our points. It will take you about 45 minutes to get a straight answer. If we can make it happen often enough, maybe AC and AE will wake up and figure out a way to properly deal with this incredibly frustrating situation.