This project is read-only.

Attributes for anonymous and state machine methods

Topics: C# Language Design, VB Language Design
Oct 23, 2014 at 7:36 AM
With async/await and LINQ anonymous methods and state machine methods are used very wide.
At the same time, we are not able to mark them with attributes. It became a big trouble when we are talking about security attributes, such as [SecuritySafe] and [SecurityCritical] and also CAS attributes. Work with assemblies mark with[AllowpartiallyTrustedCaller] is much harder in that case.
If we be able to control attributes for anonymous and state machine methods, or at least they have same attributes (maybe it should work only with some attributes) at they parent methods - it would be much easier to write code such code.
Nov 7, 2014 at 11:52 PM
We currently make a point to copy the DebuggerHidden attribute, but not much else. With LINQ and anonymous methods you could do it yourself, but that doesn't feel reasonable for async/await. Copying these attributes to the generated methods sounds reasonable. We'd have to decide which attributes we do that for.

Please file an issue for this.