Wiki

UnauthorizedAccessException

There are different reasons why you might get this exception. One of them is that you are trying to delete an assembly that you loaded (but obviously don't need any more). The solution is to change this:

assembly = Assembly.loadFrom(path)

to this:

assembly = Assembly.load(File.readAllBytes(path))

See Also