views:

201

answers:

1

On SQL Server 2008, I'm attempting to register an assembly that seems to only reference the supported libraries. Here is the T-SQL code that I'm using to register the assembly:

create assembly MySpatial from 'c:\Spatial.dll'

This results in the following error:

Msg 6509, Level 16, State 31, Line 1 An error occurred while gathering metadata from assembly 'Spatial' with HRESULT 0x80004005.

However, if I add with permission_set=unsafe, then SQL will execute the command successfully. How can I find out why the error occurred, or why my assembly must be registered as unsafe?

A: 

When persmission set is unsafe, SQL won't verify the metadata of your assembly.

Try to apply the hotfix from KB 941256, or apply CU4 for SP2. Altough is a different HRESULT than the E_FAIL you're getting, perhaps the hotfix addresses the issue.

Remus Rusanu
Sure, I understand that when permissions are set to unsafe that SQL will just let it through. However, I'm trying to find out what is it about my assembly that isn't considered safe?Also, the links that you provided only apply to SQL Server 2005, not 2008.