Creating SQL Assembly error Method parent has circular class type parameter constraints I'm trying to add an assembly to SQL server 2012 but I'm getting the following errors. I've tested the dll and it works fine from C# so don't think it's a code issue.  Any suggestions?

Msg 6218, Level 16, State 2, Line 6
CREATE ASSEMBLY for assembly 'HMDACalculateULICheckDigit' failed because assembly 'HMDACalculateULICheckDigit' failed verification. Check if the referenced assemblies are up-to-date and trusted (for external_access or unsafe) to execute in the database. CLR Verifier error messages if any will follow this message
[ : CalculateULICheckDigitCLR::.ctor][mdToken=0x6000002][offset 0x00000000] Method parent has circular class type parameter constraints.
[ : CalculateULICheckDigitCLR::CalculateULICheckDigitHMDA][mdToken=0x6000001][offset 0x00000000] Method parent has circular class type parameter constraints.


The C# itself is pretty simple.

public class CalculateULICheckDigitCLR
{
public static int CalculateULICheckDigitHMDA(string val)
{
    int result;

    result =  (int)(BigInteger.Parse(val) % 97);
    return result;
}
}


Example of value I'm passing in 548322619182814292318016211461767828260500
The issue probably has something to do with the BigInteger class. It is found in System.Numerics which is not in the list of Supported .NET Framework Libraries. Which means that you probably loaded that manually as UNSAFE (or have not loaded it yet?). Which then means that your assembly, HMDACalculateULICheckDigit, needs to be marked as UNSAFE.

This assessment is further supported by the fact that you got a "failed verification" error message, since verification is a process that happens at CREATE ASSEMBLY time and checks for obvious indicators of requiring UNSAFE.