Surface versus bulk nucleation of dislocations during contact