Removing an App?

You should be catching your exceptions so that it doesn’t crash, and using API 2 methods so that you get exceptions when something goes wrong. Odds are a file is still in use or you don’t have permission. If the file is in use, I bet you need to wait for the updater to finish before trying to delete it. If you don’t have permission, something like what Beatrix suggested would be needed.

Your function might look something like

Function DeepDelete(Extends Target As FolderItem)
  If Target.IsFolder Then
    For Each Child As FolderItem In Target.Children(False)
      Child.DeepDelete
    Next
  End If
  Target.Remove
End Function

Then use it like:

Try
  UpdaterApp.DeepDelete
Catch Err As IOException
  // Do something to handle the error
End Try

I would not recommend putting the exception handling inside the method so that you can control its behavior on a case-by-case basis.

Anyway, Err will have more details about what went wrong, and you can stop the app from crashing.