This line of code adds the details of the exception ex to the computer’s application log:
LogException ex