Input string was not in a correct format.
It's pretty clear. You are trying to convert some data into a datatype that is incorrect.
Based on the line you mention, this means that username is not of type
Int64
. Further, AFAIK,
Environment.Username
is of type
String
. Thus, when you try to convert it into
Int64
, you get an error. It's a string, not an integer.
Refer:
MSDN: Environment.UserName Property [
^]