Using Jint in CLR function

Oct 10, 2011 at 10:44 AM
Edited Oct 10, 2011 at 1:29 PM

I am trying to use Jint in a CLR function, that can be executed in SQL via a UDF. But I got following error while trying to create assembly using the latest jint.dll file:

--create assembly
CREATE ASSEMBLY Jint
FROM
'../jint.dll'
WITH PERMISSION_SET = SAFE


Msg 6218, Level 16, State 2, Line 1CREATE ASSEMBLY for assembly 'Jint' failed because assembly 'Jint' 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
[ : Jint.Native.JsRegExp::ToString][mdToken=0x6000472][offset 0x0000004E][found ref 'System.Object'][expected ref 'System.String'] Unexpected type on the stack.
[ : Jint.Native.JsRegExp::ToString][mdToken=0x6000472][offset 0x0000006F][found ref 'System.Object'][expected ref 'System.String'] Unexpected type on the stack.
[ : Jint.Native.JsRegExp::ToString][mdToken=0x6000472][offset 0x00000090][found ref 'System.Object'][expected ref 'System.String'] Unexpected type on the stack.
[ : Jint.Native.JsArray::join][mdToken=0x60004f8][offset 0x00000095][found ref 'System.Object'][expected ref 'System.String'] Unexpected type on the stack.
[ : Antlr.Runtime.BaseRecognizer::PushFollow][mdToken=0x6000684][offset 0x00000060][found ref 'System.Object'][expected ref 'Antlr.Runtime.BitSet'] Unexpected type on the stack.

I am using Visual Studio 10, Target DotNet Framework 3.5 and SQL Server 2008. I have also tried with PERMISSION_SET EXTERNAL_ACCESS, but the error message is the same. However the code works when setting PERMISSION_SET as UNSAFE, but I guess it requires setting the trustworthy property in db, which wouldn't be allowed in production version.

Am I missing something? Any help on this will be greatly appreciated.