public string ThrowNullRef() { //Before we throw, let's write smth to local log; OpContext.WriteLogMessage("Throwing NullReference exception..."); string foo = null; if (foo.Length > 10) { foo = "bar"; } return(foo); }