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?
Msg 6522, Level 16, State 1, Line 4
A .NET Framework error occurred during execution of user-defined routine or aggregate "CalculateInfo":
System.Security.HostProtectionException: Attempted to perform an operation that was forbidden by the CLR host.The protected resources (only available with full trust) were: All
The demanded resources were: Synchronization, ExternalThreadingSystem.Security.HostProtectionException:
at UserDefinedFunctions.getData()
at UserDefinedFunctions.CalculateInfo()
This error, as noted in your other question, Deploying SQLCLR project fails when creating assembly in database, requires the following:
ALTER ASSEMBLY [AssemblyName]
WITH PERMISSION_SET = UNSAFE;
For more information on working with SQLCLR in general, please visit: SQLCLR Info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With