Using Unity in Partial Trust Environments

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Unity Application Block information can be found at the Unity Application Block site.

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 the Unity Application Block 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 MSIL code, see Security Issues in Reflection Emit for .NET 3.5 and Security Issues in Reflection Emit for .NET 2.0.