Using <see langword="…" /> crashes due to NullReferenceException
atifaziz opened this issue · comments
Using the undocumented attribute langword
for <see>
, as in <see langword="null" />
, crashes with NullReferenceException
:
System.NullReferenceException: Object reference not set to an instance of an object.
at Vsxmd.Units.Extensions.ToMarkdownSpan(XNode node) in C:\Vsxmd\Vsxmd\Units\Extensions.cs:line 161
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
at Vsxmd.Units.Extensions.ToMarkdownText(XElement element) in C:\Vsxmd\Vsxmd\Units\Extensions.cs:line 142
at Vsxmd.Units.BaseUnit.get_ElementContent() in C:\Vsxmd\Vsxmd\Units\BaseUnit.cs:line 44
at Vsxmd.Units.ExceptionUnit.get_Description() in C:\Vsxmd\Vsxmd\Units\ExceptionUnit.cs:line 31
at Vsxmd.Units.ExceptionUnit.ToMarkdown() in C:\Vsxmd\Vsxmd\Units\ExceptionUnit.cs:line 35
at Vsxmd.Units.ExceptionUnit.<>c.<ToMarkdown>b__6_1(ExceptionUnit unit) in C:\Vsxmd\Vsxmd\Units\ExceptionUnit.cs:line 55
at System.Linq.Enumerable.<SelectManyIterator>d__16`2.MoveNext()
at System.Linq.Enumerable.<ConcatIterator>d__58`1.MoveNext()
at System.String.Join(String separator, IEnumerable`1 values)
at Vsxmd.Units.ExceptionUnit.ToMarkdown(IEnumerable`1 elements) in C:\Vsxmd\Vsxmd\Units\ExceptionUnit.cs:line 64
at Vsxmd.Units.MemberUnit.get_Exceptions() in C:\Vsxmd\Vsxmd\Units\MemberUnit.cs:line 98
at Vsxmd.Units.MemberUnit.ToMarkdown() in C:\Vsxmd\Vsxmd\Units\MemberUnit.cs:line 114
at Vsxmd.Converter.<>c.<ToMarkdown>b__3_0(IUnit x) in C:\Vsxmd\Vsxmd\Converter.cs:line 39
at System.Linq.Enumerable.<SelectManyIterator>d__16`2.MoveNext()
at System.String.Join(String separator, IEnumerable`1 values)
at Vsxmd.Units.Extensions.Join(IEnumerable`1 value, String separator) in C:\Vsxmd\Vsxmd\Units\Extensions.cs:line 34
at Vsxmd.Converter.ToMarkdown() in C:\Vsxmd\Vsxmd\Converter.cs:line 38
at Vsxmd.Program.Main(String[] args) in C:\Vsxmd\Vsxmd\Program.cs:line 52
Let me understand the <see langword="…" />
tag. I searched in Google, almost all examples only show langword equals true
, false
or null
. Is that all the case? Other possible values?
A VB programmer, however, might use True
, False
or Nothing
. I've also see C# examples using switch
, which would translate to Select
in VB. I think this was mostly used by the MSDN documentation to provide translation of keywords depending on the language filter being applied. I think it's safe to say that one could just use the value of langword
verbatim but formatted in back-ticks.
@atifaziz I am going to publish a new version with this fix. Do you have any other coming issues except the generic one? 😄