Page MenuHomePhabricator

Remove SecurityAction.Demand decoration from AWB's MainForm class
Closed, ResolvedPublicFeature

Description

MainWindow is decorated with:
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]

This appears to be superfluous; current documentation suggests that CAS is no longer supported, and I believe it is unwarranted in this case. Opening this Issue before editing the source in case someone else has insight.

The decoration enforces a longer prolog on each method, with a call to clr!JIT_Security_Prolog, which is short but sometimes dives into much more complex stuff. This in turn means that no methods get inlined in the Release build, no matter how trivial. Removing the decoration tightens up the optimized code. I realize this is not significant in either performance or memory, but it won't hurt.

I discussed this with @MaxSem recently. Obviously it's so long ago he can't be expected to remember the details. He added it in 2007, most likely to make the accompanying ComVisibleAttribute(true) work, but he removed the latter in 2009.

The security demand also appears, commented out, in WikiFunctions\ObjectCache.cs.

Event Timeline

DavidBrooks claimed this task.

SVN revision 13013