diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs index 7b70cba326ba64b9b01e4b7e594fd2b68e61b99d..0daa6a51f523172716694857f735b8349160bb23 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceEventSymbol.cs @@ -30,6 +30,7 @@ internal abstract class SourceEventSymbol : EventSymbol, IAttributeTargetSymbol private SymbolCompletionState _state; private CustomAttributesBag _lazyCustomAttributesBag; private string _lazyDocComment; + private string _lazyExpandedDocComment; private OverriddenOrHiddenMembersResult _lazyOverriddenOrHiddenMembers; private ThreeState _lazyIsWindowsRuntimeEvent = ThreeState.Unknown; @@ -587,7 +588,8 @@ protected void CheckModifiersAndType(DiagnosticBag diagnostics) public override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default(CancellationToken)) { - return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref _lazyDocComment); + ref var lazyDocComment = ref expandIncludes ? ref _lazyExpandedDocComment : ref _lazyDocComment; + return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref lazyDocComment); } protected static void CopyEventCustomModifiers(EventSymbol eventWithCustomModifiers, ref TypeWithAnnotations type, AssemblySymbol containingAssembly) diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceFieldSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceFieldSymbol.cs index b1087a35f9057db62a84199ddaef1ccb3ad99488..717a8be100742217103cd0354d469aa8d3006c43 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceFieldSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceFieldSymbol.cs @@ -150,6 +150,7 @@ internal abstract class SourceFieldSymbolWithSyntaxReference : SourceFieldSymbol private readonly SyntaxReference _syntaxReference; private string _lazyDocComment; + private string _lazyExpandedDocComment; private ConstantValue _lazyConstantEarlyDecodingValue = Microsoft.CodeAnalysis.ConstantValue.Unset; private ConstantValue _lazyConstantValue = Microsoft.CodeAnalysis.ConstantValue.Unset; @@ -221,7 +222,8 @@ public sealed override ImmutableArray DeclaringSyntaxReferences public sealed override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default(CancellationToken)) { - return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref _lazyDocComment); + ref var lazyDocComment = ref expandIncludes ? ref _lazyExpandedDocComment : ref _lazyDocComment; + return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref lazyDocComment); } internal sealed override ConstantValue GetConstantValue(ConstantFieldsInProgress inProgress, bool earlyDecodingWellKnownAttributes) diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs index 0eb41bcc7d52736fc56e0d7560dc305a4068aa75..47fbdd4368a63ed1467704401cb0337998b606c3 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberMethodSymbol.cs @@ -164,6 +164,7 @@ public void EnsureMetadataVirtual() protected ImmutableArray locations; protected string lazyDocComment; + protected string lazyExpandedDocComment; //null if has never been computed. Initial binding diagnostics //are stashed here in service of API usage patterns @@ -674,6 +675,7 @@ public sealed override ImmutableArray DeclaringSyntaxReferences public override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default(CancellationToken)) { + ref var lazyDocComment = ref expandIncludes ? ref this.lazyExpandedDocComment : ref this.lazyDocComment; return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref lazyDocComment); } diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs index ddb0796c37062dcb264de56a64e2262f5929a096..389fe2fbfe03569cd8b62b1b97114c97d017b57f 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs @@ -30,6 +30,7 @@ internal sealed partial class SourceNamedTypeSymbol : SourceMemberContainerTypeS private CustomAttributesBag _lazyCustomAttributesBag; private string _lazyDocComment; + private string _lazyExpandedDocComment; private ThreeState _lazyIsExplicitDefinitionOfNoPiaLocalType = ThreeState.Unknown; @@ -109,7 +110,8 @@ private static SyntaxToken GetName(CSharpSyntaxNode node) public override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default(CancellationToken)) { - return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref _lazyDocComment); + ref var lazyDocComment = ref expandIncludes ? ref _lazyExpandedDocComment : ref _lazyDocComment; + return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref lazyDocComment); } #endregion diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs index d029e1501328c4f56c47e8328c555dfe2eeb7bd7..c41c42378831c292cd586bb6d27ebda5ffa0a498 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs @@ -751,7 +751,8 @@ public override MethodSymbol PartialImplementationPart public override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default(CancellationToken)) { - return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this.SourcePartialImplementation ?? this, expandIncludes, ref lazyDocComment); + ref var lazyDocComment = ref expandIncludes ? ref this.lazyExpandedDocComment : ref this.lazyDocComment; + return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(SourcePartialImplementation ?? this, expandIncludes, ref lazyDocComment); } internal override bool IsExplicitInterfaceImplementation diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.cs index 38b95d6f51250b8b0119e35e2132cd3ecc3658b4..cc60be9fd4a1c27f4b15013953afe9d3baec8fdd 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbol.cs @@ -45,6 +45,7 @@ internal sealed class SourcePropertySymbol : PropertySymbol, IAttributeTargetSym private readonly string _sourceName; private string _lazyDocComment; + private string _lazyExpandedDocComment; private OverriddenOrHiddenMembersResult _lazyOverriddenOrHiddenMembers; private SynthesizedSealedPropertyAccessor _lazySynthesizedSealedAccessor; private CustomAttributesBag _lazyCustomAttributesBag; @@ -1051,7 +1052,8 @@ private static void CheckAbstractPropertyAccessorNotPrivate(SourcePropertyAccess public override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default(CancellationToken)) { - return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref _lazyDocComment); + ref var lazyDocComment = ref expandIncludes ? ref _lazyExpandedDocComment : ref _lazyDocComment; + return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref lazyDocComment); } // Separate these checks out of FindExplicitlyImplementedProperty because they depend on the accessor symbols, diff --git a/src/Compilers/CSharp/Test/Symbol/DocumentationComments/IncludeTests.cs b/src/Compilers/CSharp/Test/Symbol/DocumentationComments/IncludeTests.cs new file mode 100644 index 0000000000000000000000000000000000000000..b04494ee2cb175f3afb062e99648edba5b900048 --- /dev/null +++ b/src/Compilers/CSharp/Test/Symbol/DocumentationComments/IncludeTests.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Linq; +using Microsoft.CodeAnalysis.CSharp.Symbols; +using Microsoft.CodeAnalysis.CSharp.Test.Utilities; +using Roslyn.Test.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.CSharp.UnitTests +{ + public class IncludeTests : CSharpTestBase + { + [Theory] + [InlineData("Field", "F:Acme.Widget.Field")] + [InlineData(WellKnownMemberNames.StaticConstructorName, "M:Acme.Widget.#cctor")] + [InlineData("Event", "E:Acme.Widget.Event")] + [InlineData("Property", "P:Acme.Widget.Property")] + [InlineData("Method", "M:Acme.Widget.Method")] + [InlineData("NamedType", "T:Acme.Widget.NamedType")] + public void TestDocumentationCaching(string symbolName, string documentationId) + { + using var _ = new EnsureEnglishUICulture(); + + var compilation = CreateCompilationWithMscorlib40AndDocumentationComments(@"namespace Acme +{ + class Widget + { + /// + int Field; + + /// + static Widget() { } + + /// + event EventHandler Event; + + /// + int Property { get; } + + /// + void Method() { } + + /// + class NamedType { } + } +} +"); + + var acmeNamespace = (NamespaceSymbol)compilation.GlobalNamespace.GetMembers("Acme").Single(); + var widgetClass = acmeNamespace.GetTypeMembers("Widget").Single(); + + var symbol = widgetClass.GetMembers(symbolName).Single(); + Assert.Equal(documentationId, symbol.GetDocumentationCommentId()); + Assert.Equal( +$@" + + +", symbol.GetDocumentationCommentXml(expandIncludes: true)); + Assert.Equal( +$@" + + +", symbol.GetDocumentationCommentXml(expandIncludes: false)); + Assert.Equal( +$@" + + +", symbol.GetDocumentationCommentXml(expandIncludes: true)); + Assert.Equal( +$@" + + +", symbol.GetDocumentationCommentXml(expandIncludes: false)); + } + } +} diff --git a/src/Compilers/VisualBasic/Portable/DocumentationComments/SourceDocumentationCommentUtils.vb b/src/Compilers/VisualBasic/Portable/DocumentationComments/SourceDocumentationCommentUtils.vb index 28dd9b1384ea6f8d017a50c47b6f85f14c5354a5..3d89bf84a046134a4582b0bb71142e4c56731e2a 100644 --- a/src/Compilers/VisualBasic/Portable/DocumentationComments/SourceDocumentationCommentUtils.vb +++ b/src/Compilers/VisualBasic/Portable/DocumentationComments/SourceDocumentationCommentUtils.vb @@ -1,14 +1,25 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -Imports System.Text -Imports System.Threading Imports System.Globalization -Imports Microsoft.CodeAnalysis.Text -Imports Microsoft.CodeAnalysis.VisualBasic.Symbols -Imports Microsoft.CodeAnalysis.VisualBasic.Syntax +Imports System.Threading Namespace Microsoft.CodeAnalysis.VisualBasic Friend Module SourceDocumentationCommentUtils + Friend Function GetAndCacheDocumentationComment( + symbol As Symbol, + preferredCulture As CultureInfo, + expandIncludes As Boolean, + ByRef lazyXmlText As String, + cancellationToken As CancellationToken + ) As String + + If lazyXmlText Is Nothing Then + Dim xmlText = GetDocumentationCommentForSymbol(symbol, preferredCulture, expandIncludes, cancellationToken) + Interlocked.CompareExchange(lazyXmlText, xmlText, Nothing) + End If + + Return lazyXmlText + End Function ''' ''' Returns documentation comment for a type, field, property, event or method, diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceEventSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceEventSymbol.vb index d726e0ab9a89fa12d7860170427de23fabd882f0..bf65deb3bfbefa8d341991c3a67945797682e2dc 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceEventSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceEventSymbol.vb @@ -43,6 +43,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Private _lazyImplementedEvents As ImmutableArray(Of EventSymbol) Private _lazyDelegateParameters As ImmutableArray(Of ParameterSymbol) Private _lazyDocComment As String + Private _lazyExpandedDocComment As String ' Attributes on event. Set once after construction. IsNull means not set. Private _lazyCustomAttributesBag As CustomAttributesBag(Of VisualBasicAttributeData) @@ -690,13 +691,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Public Overrides Function GetDocumentationCommentXml(Optional preferredCulture As CultureInfo = Nothing, Optional expandIncludes As Boolean = False, Optional cancellationToken As CancellationToken = Nothing) As String - If _lazyDocComment Is Nothing Then - ' NOTE: replace Nothing with empty comment - Interlocked.CompareExchange( - _lazyDocComment, GetDocumentationCommentForSymbol(Me, preferredCulture, expandIncludes, cancellationToken), Nothing) + If expandIncludes Then + Return GetAndCacheDocumentationComment(Me, preferredCulture, expandIncludes, _lazyExpandedDocComment, cancellationToken) + Else + Return GetAndCacheDocumentationComment(Me, preferredCulture, expandIncludes, _lazyDocComment, cancellationToken) End If - - Return _lazyDocComment End Function Friend Shared Function DecodeModifiers(modifiers As SyntaxTokenList, diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceFieldSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceFieldSymbol.vb index 291f6bdc89da27c012b19d910db5a9097e3041f7..e0bdc8d09046be0d1761410f22bdd690e2f8e3c1 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceFieldSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceFieldSymbol.vb @@ -26,6 +26,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Private ReadOnly _syntaxRef As SyntaxReference Private _lazyDocComment As String + Private _lazyExpandedDocComment As String Private _lazyCustomAttributesBag As CustomAttributesBag(Of VisualBasicAttributeData) ' Set to 1 when the compilation event has been produced @@ -112,13 +113,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Property Public Overrides Function GetDocumentationCommentXml(Optional preferredCulture As CultureInfo = Nothing, Optional expandIncludes As Boolean = False, Optional cancellationToken As CancellationToken = Nothing) As String - If _lazyDocComment Is Nothing Then - ' NOTE: replace Nothing with empty comment - Interlocked.CompareExchange( - _lazyDocComment, GetDocumentationCommentForSymbol(Me, preferredCulture, expandIncludes, cancellationToken), Nothing) + If expandIncludes Then + Return GetAndCacheDocumentationComment(Me, preferredCulture, expandIncludes, _lazyExpandedDocComment, cancellationToken) + Else + Return GetAndCacheDocumentationComment(Me, preferredCulture, expandIncludes, _lazyDocComment, cancellationToken) End If - - Return _lazyDocComment End Function ''' diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMethodSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMethodSymbol.vb index 9606f0ef0e0ab6e8694e89b34703cf69ea7dfec0..ea82dba0a865ef6e75f16fe789b8355381445250 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMethodSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMethodSymbol.vb @@ -45,6 +45,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Private _lazyLocations As ImmutableArray(Of Location) Private _lazyDocComment As String + Private _lazyExpandedDocComment As String 'Nothing if diags have never been computed. Initial binding diagnostics 'are stashed here to optimize API usage patterns @@ -806,13 +807,11 @@ lReportErrorOnTwoTokens: End Function Public NotOverridable Overrides Function GetDocumentationCommentXml(Optional preferredCulture As CultureInfo = Nothing, Optional expandIncludes As Boolean = False, Optional cancellationToken As CancellationToken = Nothing) As String - If _lazyDocComment Is Nothing Then - ' NOTE: replace Nothing with empty comment - Interlocked.CompareExchange( - _lazyDocComment, GetDocumentationCommentForSymbol(Me, preferredCulture, expandIncludes, cancellationToken), Nothing) + If expandIncludes Then + Return GetAndCacheDocumentationComment(Me, preferredCulture, expandIncludes, _lazyExpandedDocComment, cancellationToken) + Else + Return GetAndCacheDocumentationComment(Me, preferredCulture, expandIncludes, _lazyDocComment, cancellationToken) End If - - Return _lazyDocComment End Function ''' diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceNamedTypeSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceNamedTypeSymbol.vb index 9b838e15995b32a06051b77b3c548c1f46510f39..5dc51ab7af9a708299a59c5d24c4849851de6f83 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceNamedTypeSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceNamedTypeSymbol.vb @@ -30,6 +30,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Private ReadOnly _corTypeId As SpecialType Private _lazyDocComment As String + Private _lazyExpandedDocComment As String Private _lazyEnumUnderlyingType As NamedTypeSymbol ' Stores symbols for overriding WithEvents properties if we have such @@ -138,12 +139,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Function Public Overrides Function GetDocumentationCommentXml(Optional preferredCulture As CultureInfo = Nothing, Optional expandIncludes As Boolean = False, Optional cancellationToken As CancellationToken = Nothing) As String - If _lazyDocComment Is Nothing Then - ' NOTE: replace Nothing with empty comment - Interlocked.CompareExchange( - _lazyDocComment, GetDocumentationCommentForSymbol(Me, preferredCulture, expandIncludes, cancellationToken), Nothing) + If expandIncludes Then + Return GetAndCacheDocumentationComment(Me, preferredCulture, expandIncludes, _lazyExpandedDocComment, cancellationToken) + Else + Return GetAndCacheDocumentationComment(Me, preferredCulture, expandIncludes, _lazyDocComment, cancellationToken) End If - Return _lazyDocComment End Function ' Create a LocationSpecificBinder for the type. This is a binder that wraps the diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourcePropertySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourcePropertySymbol.vb index 35e578c32af6dc5cadc73cd5f5ad3c626519296b..83f39e24e1feb4111a03afbfc57635366cc91a48 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourcePropertySymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourcePropertySymbol.vb @@ -32,6 +32,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Private _setMethod As MethodSymbol Private _backingField As FieldSymbol Private _lazyDocComment As String + Private _lazyExpandedDocComment As String Private _lazyMeParameter As ParameterSymbol ' Attributes on property. Set once after construction. IsNull means not set. @@ -1051,13 +1052,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Function Public Overrides Function GetDocumentationCommentXml(Optional preferredCulture As CultureInfo = Nothing, Optional expandIncludes As Boolean = False, Optional cancellationToken As CancellationToken = Nothing) As String - If _lazyDocComment Is Nothing Then - ' NOTE: replace Nothing with empty comment - Interlocked.CompareExchange( - _lazyDocComment, GetDocumentationCommentForSymbol(Me, preferredCulture, expandIncludes, cancellationToken), Nothing) + If expandIncludes Then + Return GetAndCacheDocumentationComment(Me, preferredCulture, expandIncludes, _lazyExpandedDocComment, cancellationToken) + Else + Return GetAndCacheDocumentationComment(Me, preferredCulture, expandIncludes, _lazyDocComment, cancellationToken) End If - - Return _lazyDocComment End Function Private Shared Function DecodeModifiers(modifiers As SyntaxTokenList, diff --git a/src/Compilers/VisualBasic/Test/Symbol/DocumentationComments/IncludeTests.vb b/src/Compilers/VisualBasic/Test/Symbol/DocumentationComments/IncludeTests.vb new file mode 100644 index 0000000000000000000000000000000000000000..5d2dd2c4636244f4626242593b3ebf60d595b7be --- /dev/null +++ b/src/Compilers/VisualBasic/Test/Symbol/DocumentationComments/IncludeTests.vb @@ -0,0 +1,71 @@ +' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +Imports Microsoft.CodeAnalysis.VisualBasic.Symbols +Imports Roslyn.Test.Utilities + +Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests + Public Class IncludeTests + + + + + + + + Public Sub TestDocumentationCaching(symbolName As String, documentationId As String) + Using New EnsureEnglishUICulture() + Dim compilation = CreateCompilationWithMscorlib40( + + + Namespace Acme + Class Widget + ''' <include file="NonExistent.xml" /> + Dim F As Integer + + ''' <include file="NonExistent.xml" /> + Shared Sub New() + End Sub + + ''' <include file="NonExistent.xml" /> + Event E As EventHandler + + ''' <include file="NonExistent.xml" /> + Property P As Integer + + ''' <include file="NonExistent.xml" /> + Sub M() + End Sub + + ''' <include file="NonExistent.xml" /> + Class NamedType + End Class + End Class + End Namespace + + ) + + Dim acmeNamespace = DirectCast(compilation.GlobalNamespace.GetMembers("Acme").Single(), NamespaceSymbol) + Dim widgetClass = acmeNamespace.GetTypeMembers("Widget").Single() + + Dim symbol = widgetClass.GetMembers(symbolName).Single() + Assert.Equal(documentationId, symbol.GetDocumentationCommentId()) + Assert.Equal( +$" + +", symbol.GetDocumentationCommentXml(expandIncludes:=True)) + Assert.Equal( +$" + +", symbol.GetDocumentationCommentXml(expandIncludes:=False)) + Assert.Equal( +$" + +", symbol.GetDocumentationCommentXml(expandIncludes:=True)) + Assert.Equal( +$" + +", symbol.GetDocumentationCommentXml(expandIncludes:=False)) + End Using + End Sub + End Class +End Namespace