title: System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host
body: <p>I'm using threading in my SQLCLR Project and I'm getting the following error when I try to run my user defined function. What can I do to enable threading things such as the Parallel library and await/async in my project?</p>
  
  <blockquote>
    <p>Msg 6522, Level 16, State 1, Line 4<br>
    A .NET Framework error occurred during execution of user-defined routine or aggregate "CalculateInfo":<br>
    &nbsp; System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host.  </p>
    
    <p>&nbsp; &nbsp; The protected resources (only available with full trust) were: All<br>
    &nbsp; &nbsp; The demanded resources were: Synchronization, ExternalThreading  </p>
    
    <p>&nbsp; &nbsp; System.Security.HostProtectionException:<br>
    &nbsp; &nbsp; &nbsp; &nbsp; at UserDefinedFunctions.getData()<br>
    &nbsp; &nbsp; &nbsp; &nbsp; at UserDefinedFunctions.CalculateInfo()</p>
  </blockquote>