lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Jordan <>
Subject Re: Still a problem with medium trust: unmanaged code
Date Mon, 24 May 2010 17:17:44 GMT
On 24.05.2010 17:41, Simone Chiaretta wrote:
> Hi all,
> whereas the latest updates fixed the problem with "standard" medium trust,
> in some environment there is also another error being raised:
> [SecurityException: Request for the permission of type
> 'System.Security.Permissions.SecurityPermission, mscorlib, Version=,
> Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
>     FileSupport.Sync(FileStream fileStream) in SupportClass.cs:495
>     Lucene.Net.Store.FSDirectory.Sync(String name) in FSDirectory.cs:831
>     Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) in
> SegmentInfos.cs:998
>     ....
> It looks like the problem is when the Sync method calls the unmanaged code:
> private static extern bool FlushFileBuffers(IntPtr hFile);
> Is there a reason why both the managed and the unmanaged flush are used?

Yes. It ensures that the file's cache really hits the file system.
You may want to add a try-catch block around it as there is
no other way to achieve this w/out calling into unmanaged code.


View raw message