Effettivamente mettendo tmpVar come String non da errore il programma ma bensì Windows con il fatidico errore di protezione generale...
perchè?