Using Unity in Partial Trust Environments

Unity uses dynamically generated methods to perform injection, and the .NET Framework security model imposes some security limitations that you should be aware of if you want to use Unity in applications that will run in less than full trust environments. The limitation when using Unity in a partial trust environment is that you cannot register and use mappings using the RegisterType methods where the target class is internal (C#), Friend (Visual Basic .NET), private (C#), or Private (Visual Basic .NET).

For more information about security issues when using dynamically generated Microsoft intermediate language (MSIL) code, see Security Issues in Reflection Emit for .NET 3.5 and Security Issues in Reflection Emit for .NET 2.0.