-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed as not planned
Labels
api-ready-for-reviewAPI is ready for review, it is NOT ready for implementationAPI is ready for review, it is NOT ready for implementationarea-System.Reflection
Milestone
Description
Background and motivation
For adding AssemblyBuilder.Save() equivalent in .NET Core we have abstracted most of the System.Refleciton.Emit types and adding new implementations for them. This abstraction did not cover LocalBuilder type and its constructor is internal, so I could not create an instance from the new ILGenerator implementation. We need a same treatment for this type: to unseal the LocalBuilder class and make it abstract, make the internal constructor protected, also add a public getter that exposes the method the local belongs.
Related to #92975
API Proposal
namespace System.Reflection.Emit;
-public sealed class LocalBuilder : System.Reflection.LocalVariableInfo
+public abstract class LocalBuilder : System.Reflection.LocalVariableInfo
{
- internal LocalBuilder(int localIndex, Type localType, MethodInfo method, bool isPinned) { }
+ protected LocalBuilder() { }
+ public abstract MethodInfo LocalMethod { get; }
}Abstract LocalMethod property can be used for validation. Parent LocalVariableInfo has public virtual properties like LocalType, LocalIndex, IsPinned.
Metadata
Metadata
Assignees
Labels
api-ready-for-reviewAPI is ready for review, it is NOT ready for implementationAPI is ready for review, it is NOT ready for implementationarea-System.Reflection