Being able to see more code would help us to see where the problem might be occurring.
Is this a web app? If you refresh the page which I assume has a field to enter a user name, it won't have any value and then it will try to run.
Is this a web app? If you refresh the page which I assume has a field to enter a user name, it won't have any value and then it will try to run.
var user = User.GetUserFromId(null);