In situ characterization of optoelectronic nanostructures and nanodevices