This is a suggested improvement to the way the source is generated for the underlying type that is bing wrapped. There is no particular bug associated with this, but the suggested alternative looks a lot more robust in terms of including the namespace, any global alias if needed, and any escaping, if needed.
The current code, when setting the underlying type (VoWorkItem.cs), uses INamedTypeSymbol.FullName:
public INamedTypeSymbol UnderlyingType
{
get => _underlyingType;
set
{
_underlyingType = value;
_underlyingTypeFullName = value.FullName() ?? value?.Name ?? throw new InvalidOperationException(
"No underlying type specified - please file a bug at https://github.com/SteveDunn/Vogen/issues/new?assignees=&labels=bug&template=BUG_REPORT.yml");
}
Instead of value.FullName, then falling back to value.Name, it should instead use
/// <summary>
/// Formats the names of all types and namespaces in a fully qualified style (including the global alias).
/// </summary>
/// <remarks>
/// The current behavior will not output the fully qualified style as expected for member symbols (such as properties) because memberOptions is not set.
/// For example, MyNamespace.MyClass.MyPublicProperty will return as MyPublicProperty.
/// The current behavior displayed here will be maintained for backwards compatibility.
/// </remarks>
public static SymbolDisplayFormat FullyQualifiedFormat { get; } =
new SymbolDisplayFormat(
globalNamespaceStyle: SymbolDisplayGlobalNamespaceStyle.Included,
typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
miscellaneousOptions:
SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers |
SymbolDisplayMiscellaneousOptions.UseSpecialTypes);
Describe the feature
This is a suggested improvement to the way the source is generated for the underlying type that is bing wrapped. There is no particular bug associated with this, but the suggested alternative looks a lot more robust in terms of including the namespace, any
global
alias if needed, and any escaping, if needed.The current code, when setting the underlying type (
VoWorkItem.cs
), usesINamedTypeSymbol.FullName
:Instead of
value.FullName
, then falling back tovalue.Name
, it should instead useThat is defined in Roslyn as: