The compiler never lies:



sb=null;

construct your StringBuilder before using it, and you should have no problems.