-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API Proposal]: SignatureTypeEncoder.TypedReference()
#80812
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @dotnet/area-system-reflection-metadata Issue DetailsBackground and motivationThe roslyn compiler made two changes:
As a result, it is possible to emit reference to this type in new contexts. For example in a pointer type. Relates to dotnet/roslyn#66328 API Proposalnamespace System.Reflection.Metadata.Ecma335;
public readonly struct SignatureTypeEncoder
{
// additional method:
public void TypedReference()
{
Builder.WriteByte((byte)SignatureTypeCode.TypedReference);
}
} API Usage private void SerializeTypeReference(SignatureTypeEncoder encoder, ITypeReference typeReference)
{
while (true)
{
if (module.IsPlatformType(typeReference, PlatformType.SystemTypedReference))
{
encoder.TypedReference();
return;
}
... handle other types and recursive scenarios
} Alternative DesignsIt is possible to call RisksNo response
|
Also exists on |
Looks good as proposed. namespace System.Reflection.Metadata.Ecma335;
public readonly partial struct SignatureTypeEncoder
{
public void TypedReference();
} |
Background and motivation
The roslyn compiler made two changes:
System.TypedReference
to be managedAs a result, it is possible to emit reference to this type in new contexts. For example in a pointer type.
The natural way to do it in
Microsoft.Cci.MetadataWriter.SerializeTypeReference
would be to call aSignatureTypeEncoder.TypedReference()
method, but that method doesn't exist.Note that such an API exists on
ReturnTypeEncoder
,LocalVariableTypeEncoder
, andParameterTypeEncoder
already.Relates to dotnet/roslyn#66328
API Proposal
API Usage
Alternative Designs
It is possible to call
Builder.WriteByte((byte)SignatureTypeCode.TypedReference);
directly. That's the workaround used by the compiler for now.Risks
No response
The text was updated successfully, but these errors were encountered: