Re: FileIOPermission throws System.ExecutionEngineException
From: Andreas Håkansson (andreas.hakansson_at_nospam.com)
Date: 09/23/04
- Next message: Nicole Calinoiu: "Re: FileIOPermission throws System.ExecutionEngineException"
- Previous message: Andreas Håkansson: "FileIOPermission throws System.ExecutionEngineException"
- In reply to: Andreas Håkansson: "FileIOPermission throws System.ExecutionEngineException"
- Next in thread: Nicole Calinoiu: "Re: FileIOPermission throws System.ExecutionEngineException"
- Reply: Nicole Calinoiu: "Re: FileIOPermission throws System.ExecutionEngineException"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 23 Sep 2004 14:08:50 +0200
I can add to the equation that about 10 lines further down the code I
perform the following check
Dim UnmanagedPerm As SecurityPermission = _
New SecurityPermission(SecurityPermissionFlag.UnmanagedCode)
UnmanagedPerm.Demand()
Without any problems. I have disabaled the FileIO security check pending
some feedback, thus I know that this code is executed flawless =/
And if it is of any help, the code I'm working on is controlled by VSS.
//Andreas
"Andreas Håkansson" <andreas.hakansson@nospam.com> skrev i meddelandet
news:%23g9wlUWoEHA.3988@tk2msftngp13.phx.gbl...
> While working at a small application, and trying to be a good .net citizen
> I perform
> a check to see if the executing code has permission to work with files in
> a specific
> directory, like this
>
> Dim FilePerm As FileIOPermission = _
> New FileIOPermission(FileIOPermissionAccess.AllAccess,
> Path.GetDirectoryName(FileName))
> FilePerm.Demand()
>
> However, when the code hits the call to the Demand method it throws an
> ExecutionEngineException with the message
>
> "Unable to retrieve security descriptor for this frame."
>
> The application is a WinForm application and in the Main method I assign
> the
> current users principal to the current thread like this
>
> Shared Sub main()
>
> Dim WinUser As WindowsIdentity = _
> WindowsIdentity.GetCurrent()
> Dim WinPrincipal As New WindowsPrincipal(WinUser)
> System.Threading.Thread.CurrentThread.CurrentPrincipal =
> WinPrincipal
>
> Dim main As New MainForm
> Application.Run(main)
>
> End Sub
>
> Any ideas to the reason for this?
>
> //Andreas
>
- Next message: Nicole Calinoiu: "Re: FileIOPermission throws System.ExecutionEngineException"
- Previous message: Andreas Håkansson: "FileIOPermission throws System.ExecutionEngineException"
- In reply to: Andreas Håkansson: "FileIOPermission throws System.ExecutionEngineException"
- Next in thread: Nicole Calinoiu: "Re: FileIOPermission throws System.ExecutionEngineException"
- Reply: Nicole Calinoiu: "Re: FileIOPermission throws System.ExecutionEngineException"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|