You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After a compilation is emitted and the resulting image is loaded, we need to find a type in the loaded Assembly that corresponds to a source INamedTypeSymbol defined in the compilation.
Proposed API
namespace Microsoft.CodeAnalysis;
public class SymbolDisplayFormat
{
+ SymbolDisplayFormat MetadataDisplayFormat { get; }
}
Rather than exposing a new MetadataDisplayFormat, can we just expose UsePlusForNestedTypes option?
Let users then create the format they need
What part of metadata format does this cover? Is it class declaration? Is it call syntax with substituted generic types?
If we want to have a premade format for this scenario, we should be very precise as to what is supported and what is not.
Conclusion: Needs work. Exposing a UsePlusForNestedTypes option seems reasonable by itself. A format would then need to be very precise as to what it supports and where.
Activity
333fred commentedon Apr 11, 2024
API Review
MetadataDisplayFormat, can we just exposeUsePlusForNestedTypesoption?Conclusion: Needs work. Exposing a
UsePlusForNestedTypesoption seems reasonable by itself. A format would then need to be very precise as to what it supports and where.tmat commentedon Apr 12, 2024
My bad, I didn't notice that
s_metadataDisplayFormatis only used by tests and is not the full implementation of fully qualified name.The intention was to allow the code written in the usage example - that is, given a
ITypeSymbolreturn a fully qualified metadata name in the format that System.Reflection parses to load a type. See https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/System/Reflection/TypeNameParser.cs.This format is also used in ECMA-335 when serializing the value of System.Type for custom attribute blob. This is implemented by the compiler here: https://github.com/dotnet/roslyn/blob/main/src/Compilers/Core/Portable/PEWriter/TypeNameSerializer.cs
Examples: