[Mono-list] Mono.Data.Sqlite.dll TypeLoadException

Daniel Hughes trampster at gmail.com
Tue Nov 22 00:15:52 EST 2011


I have reported a bug for this issue here:

http://bugzilla.xamarin.com/show_bug.cgi?id=2148



On Tue, Nov 22, 2011 at 3:22 PM, Daniel Hughes <trampster at gmail.com> wrote:

> After digging arround in the source code for Mono.Data.Sqlite it appears
> that
>
> SqliteConnectionHandle implements CriticalHandle which has the following
> attribute:
>
> [SecurityPermissionAttribute(SecurityAction.InheritanceDemand,
> UnmanagedCode = true)]
>
> This requires that the inheriting class (SqliteConnectionHandle) have the
> same or more restrictive permissions. However SqliteConnectionHandle does
> not specify any security permissions and so violates the contract.
>
> This does not seem to be a problem when running on mono for linux only
> .net for windows. (maybe mono does not implement these security checks)
>
> The upshot of all this is that Mono.Data.Sqlite.dll v4.0.0.0 cannot be
> used on .net until a fix is made (adding the SecurityPermissionAttribute).
>
> I am happy to raise a bug and submit a patch (if that's the correct thing
> to do) however I can't wait for the fix to be released so will have to ship
> a custom build of Mono.Data.Sqlite.dll with a fix applied in Wide Margin
> for windows.
>
> Cheers,
> Daniel
>
>
> On Tue, Nov 22, 2011 at 1:02 PM, Daniel Hughes <trampster at gmail.com>wrote:
>
>> When trying to use Mono.Data.Sqlite v4.0.0.0 from .net on windows I get
>> the following exception
>>
>> Unhandled Exception: System.TypeLoadException: Inheritance security rules
>> violated by type: 'Mono.Data.Sqlite.SqliteConnectionHandle'. Derived types
>> must either match the security accessibility of the base type or be less
>> accessible.
>>    at Mono.Data.Sqlite.SQLite3.Open(String strFilename,
>> SQLiteOpenFlagsEnum flags, Int32 maxPoolSize, Boolean usePool)
>>    at Mono.Data.Sqlite.SqliteConnection.Open()
>>
>> Any idea whats causing this? or what I can do to work around it?
>>
>> I've been using the 2.0 version of this assembly (which works fine)
>> until recently when I tried to update to .net 4.0 support.
>>
>> Cheers,
>> Daniel
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20111122/2b6bd8b6/attachment.html 


More information about the Mono-list mailing list