The role of crystallographic defects in semiconductors for optoelectronic applications