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
I think I've found a bug in Symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat).
Previously, in my source generator, I used the following to get the fully qualified name: value.FullName() ?? value.Name ?? throw new InvalidOperationException()
But it was recommended I use .ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) instead.
But it doesn't escape everything it should.
Version Used:
Happens in all versions tested.
Steps to Reproduce:
In Vogen, my source generator, I look for ValueObject attributes and get a symbol from the underlying type argument. If I give the following horrendous (but legal) C#@
using Vogen;namespace@class{namespace record.@struct.@float
{publicreadonlyrecordstruct@decimal();publicreadonlyrecordstruct@event2();publicreadonlyrecordstruct@event();}[ValueObject(underlyingType:typeof(record.@struct.@float.@decimal))]publicpartialclassMyVo{}
... then I get different results. Here's the difference between the two:
I'm a bit confused now. In my source generator, I want to emit the fully qualified name of a symbol. Should I use FullName() or ToDisplayString(), or perhaps something else entirely?
I think I've found a bug in Symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat).
Previously, in my source generator, I used the following to get the fully qualified name:
value.FullName() ?? value.Name ?? throw new InvalidOperationException()
But it was recommended I use
.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)
instead.But it doesn't escape everything it should.
Version Used:
Happens in all versions tested.
Steps to Reproduce:
In Vogen, my source generator, I look for
ValueObject
attributes and get a symbol from the underlying type argument. If I give the following horrendous (but legal) C#@... then I get different results. Here's the difference between the two:
Expected Behavior:
value.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)
should escapedecimal
. It might also want to escaperecord
Actual Behavior:
It doesn't escape
decimal
and leads to illegal C# code being emitted from my source generator.The text was updated successfully, but these errors were encountered: