Re: Why unmanaged?

From: Ivan Medvedev [MS] (
Date: 05/14/03

  • Next message: Ivan Medvedev [MS]: "Re: SignedXml.CheckSignature fails"
    Date: Wed, 14 May 2003 09:20:03 -0700

    Guido -
    We are trying to have as little permission classes as possible and at the
    same time enough to cover all major scenarios. The need to protect
    Application.Exit didn't seem enough a reason to grant creating a new
    permission class just for that, so we looked at the "severity" of the Exit
    opertaion and what it does under the hood and chose the UnmanagedCode
    permission as the closest fit. ControlThread permission was designed to
    protect thread operations, and exiting an application is something totally
    different (for example, imaging a managed control on a page in the Internet
    Explorer: it can be ok for it to create/abort threads, but it would never be
    ok for it to exit the process, because managed controls are run in the IE
    process). Basically, if we were creating a new permission for every
    operation that needs to be protected we would have hundreds of those and it
    all would be very confusing.
    This posting is provided "AS IS" with no warranties, and confers no rights.

    "Guido Stinnez" <> wrote in message
    > Thanks Ivan,
    > that worked allright.
    > I also found out in the meantime that the documentation
    > was updated in 1.1 to the correct Permission.
    > Still, though I understand that I may need a priviliged
    > permission to call Application.Exit (like ControlThread
    > for instance) - I'm still not directly calling Unmanaged
    > Code. Maybe you could help me understand.
    > Best regards, Guido
    > >-----Original Message-----
    > >Guido -
    > >explicitly ending thread/process/application is a
    > priviledged operation, so
    > >it is normal that it is protected with a permission
    > check. Use Form.Close()
    > >to close your WinForms client.
    > >--Ivan
    > >This posting is provided "AS IS" with no warranties, and
    > confers no rights.
    > >
    > >
    > >"Guido Stinnez" <> wrote in message
    > >news:0bcb01c31951$8db39db0$a401280a@phx.gbl...
    > >> Hi!
    > >>
    > >> The Method Windows.Forms.Application.Exit() seems to
    > >> require SecurityPermissionFlag.UnmanagedCode, while the
    > >> documentation states that a UIPermission.AllWindows is
    > all
    > >> that is needed.
    > >> Someone seems to have forgotton to call an Assert ; )
    > >>
    > >> Does anyone know, whether this is a known issue and
    > >> whether or not it will be fixed (and when)?
    > >>
    > >> It is quite uncomfortable not to be able to close my
    > >> SmartClient and if I require the permission to call
    > >> unmanaged code, I could just as well require FullTrust.
    > >>
    > >> Thx, Guido
    > >
    > >
    > >.
    > >

  • Next message: Ivan Medvedev [MS]: "Re: SignedXml.CheckSignature fails"