I recently ran into a problem, when deploying an application on a customer machine. I asked him to drop a number of (updated) assemblies into the program folder. Because he downloaded them via the Dropbox website, the OS marked them as blocked and the assemblies couldn't be loaded via reflection. It took me some time to figure out the issue, with the help of this post:
.net local assembly load failed with CAS policy
I am know wondering whether it is a good idea to load the assemblies with Assembly.LoadUnsafeFrom(...)
instead of Assembly.LoadFrom(...)
, just to avoid these kind of issues in future. (I am aware of the fact that sending assemblies over the internet and letting the customer drop them into the program files folder isn't the golden path of software deployment, but in reality you sometimes need to improvise...).
As I read, the method requires the calling application to run in a full-trust environment, which is usually the case with the application I am talking about.
My question is: Apart from that - the requirement of running in full trust - are there any side effects of this method. Are there scenarios, where the application will throw an exception because of lacking privileges of the Windows User account, etc., etc.?