\n \n Statements of type '{0}' are not allowed in the Immediate window.\n '{0}' 형식의 문은 직접 실행 창에서 허용되지 않습니다.\n \n \n
\n \n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":825,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56424,"string":"56,424"},"pr_title":{"kind":"string","value":"EnC/HR interface unification"},"pr_description":{"kind":"string","value":"Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"author":{"kind":"string","value":"tmat"},"date_created":{"kind":"timestamp","value":"2021-09-15T22:22:11Z","string":"2021-09-15T22:22:11Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T16:03:37Z","string":"2021-09-21T16:03:37Z"},"previous_commit":{"kind":"string","value":"8574e338076f0a2d7a4bc0d129f00e7440e47fbb"},"pr_commit":{"kind":"string","value":"240a47028f8518833271b026667f18f2c02fcbd8"},"query":{"kind":"string","value":"EnC/HR interface unification. Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"filepath":{"kind":"string","value":"./src/Features/CSharp/Portable/Completion/CompletionProviders/Scripting/LoadDirectiveCompletionProvider.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Composition;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.Completion;\nusing Microsoft.CodeAnalysis.Completion.Providers;\nusing Microsoft.CodeAnalysis.Host.Mef;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Completion.Providers\n{\n [ExportCompletionProvider(nameof(LoadDirectiveCompletionProvider), LanguageNames.CSharp)]\n [ExtensionOrder(After = nameof(FunctionPointerUnmanagedCallingConventionCompletionProvider))]\n [Shared]\n internal sealed class LoadDirectiveCompletionProvider : AbstractLoadDirectiveCompletionProvider\n {\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public LoadDirectiveCompletionProvider()\n {\n }\n\n protected override string DirectiveName => \"load\";\n\n protected override bool TryGetStringLiteralToken(SyntaxTree tree, int position, out SyntaxToken stringLiteral, CancellationToken cancellationToken)\n => DirectiveCompletionProviderUtilities.TryGetStringLiteralToken(tree, position, SyntaxKind.LoadDirectiveTrivia, out stringLiteral, cancellationToken);\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Composition;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.Completion;\nusing Microsoft.CodeAnalysis.Completion.Providers;\nusing Microsoft.CodeAnalysis.Host.Mef;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Completion.Providers\n{\n [ExportCompletionProvider(nameof(LoadDirectiveCompletionProvider), LanguageNames.CSharp)]\n [ExtensionOrder(After = nameof(FunctionPointerUnmanagedCallingConventionCompletionProvider))]\n [Shared]\n internal sealed class LoadDirectiveCompletionProvider : AbstractLoadDirectiveCompletionProvider\n {\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public LoadDirectiveCompletionProvider()\n {\n }\n\n protected override string DirectiveName => \"load\";\n\n protected override bool TryGetStringLiteralToken(SyntaxTree tree, int position, out SyntaxToken stringLiteral, CancellationToken cancellationToken)\n => DirectiveCompletionProviderUtilities.TryGetStringLiteralToken(tree, position, SyntaxKind.LoadDirectiveTrivia, out stringLiteral, cancellationToken);\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":826,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56424,"string":"56,424"},"pr_title":{"kind":"string","value":"EnC/HR interface unification"},"pr_description":{"kind":"string","value":"Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"author":{"kind":"string","value":"tmat"},"date_created":{"kind":"timestamp","value":"2021-09-15T22:22:11Z","string":"2021-09-15T22:22:11Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T16:03:37Z","string":"2021-09-21T16:03:37Z"},"previous_commit":{"kind":"string","value":"8574e338076f0a2d7a4bc0d129f00e7440e47fbb"},"pr_commit":{"kind":"string","value":"240a47028f8518833271b026667f18f2c02fcbd8"},"query":{"kind":"string","value":"EnC/HR interface unification. Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"filepath":{"kind":"string","value":"./src/VisualStudio/Core/Def/EditorConfigSettings/Whitespace/View/ColumnDefnitions/WhitespaceCategoryColumnDefinition.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.ComponentModel.Composition;\nusing System.Windows;\nusing Microsoft.CodeAnalysis.Host.Mef;\nusing Microsoft.VisualStudio.Shell.TableControl;\nusing Microsoft.VisualStudio.Shell.TableManager;\nusing Microsoft.VisualStudio.Utilities;\nusing static Microsoft.VisualStudio.LanguageServices.EditorConfigSettings.Common.ColumnDefinitions.Whitespace;\n\nnamespace Microsoft.VisualStudio.LanguageServices.EditorConfigSettings.Whitespace.View.ColumnDefnitions\n{\n [Export(typeof(IDefaultColumnGroup))]\n [Name(nameof(WhitespaceCategoryGroupingSet))] // Required, name of the default group\n [GroupColumns(Category)] // Required, the names of the columns in the grouping\n internal class WhitespaceCategoryGroupingSet : IDefaultColumnGroup\n {\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public WhitespaceCategoryGroupingSet()\n {\n }\n }\n\n [Export(typeof(ITableColumnDefinition))]\n [Name(Category)]\n internal class WhitespaceCategoryColumnDefinition : TableColumnDefinitionBase\n {\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public WhitespaceCategoryColumnDefinition()\n {\n }\n\n public override string Name => Category;\n public override string DisplayName => ServicesVSResources.Category;\n public override double MinWidth => 80;\n public override bool DefaultVisible => false;\n public override bool IsFilterable => true;\n public override bool IsSortable => true;\n public override TextWrapping TextWrapping => TextWrapping.NoWrap;\n\n private static string? GetCategoryName(ITableEntryHandle entry)\n => entry.TryGetValue(Category, out string? categoryName)\n ? categoryName\n : null;\n\n public override IEntryBucket? CreateBucketForEntry(ITableEntryHandle entry)\n {\n var categoryName = GetCategoryName(entry);\n return categoryName is not null ? new StringEntryBucket(GetCategoryName(entry)) : null;\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.ComponentModel.Composition;\nusing System.Windows;\nusing Microsoft.CodeAnalysis.Host.Mef;\nusing Microsoft.VisualStudio.Shell.TableControl;\nusing Microsoft.VisualStudio.Shell.TableManager;\nusing Microsoft.VisualStudio.Utilities;\nusing static Microsoft.VisualStudio.LanguageServices.EditorConfigSettings.Common.ColumnDefinitions.Whitespace;\n\nnamespace Microsoft.VisualStudio.LanguageServices.EditorConfigSettings.Whitespace.View.ColumnDefnitions\n{\n [Export(typeof(IDefaultColumnGroup))]\n [Name(nameof(WhitespaceCategoryGroupingSet))] // Required, name of the default group\n [GroupColumns(Category)] // Required, the names of the columns in the grouping\n internal class WhitespaceCategoryGroupingSet : IDefaultColumnGroup\n {\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public WhitespaceCategoryGroupingSet()\n {\n }\n }\n\n [Export(typeof(ITableColumnDefinition))]\n [Name(Category)]\n internal class WhitespaceCategoryColumnDefinition : TableColumnDefinitionBase\n {\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public WhitespaceCategoryColumnDefinition()\n {\n }\n\n public override string Name => Category;\n public override string DisplayName => ServicesVSResources.Category;\n public override double MinWidth => 80;\n public override bool DefaultVisible => false;\n public override bool IsFilterable => true;\n public override bool IsSortable => true;\n public override TextWrapping TextWrapping => TextWrapping.NoWrap;\n\n private static string? GetCategoryName(ITableEntryHandle entry)\n => entry.TryGetValue(Category, out string? categoryName)\n ? categoryName\n : null;\n\n public override IEntryBucket? CreateBucketForEntry(ITableEntryHandle entry)\n {\n var categoryName = GetCategoryName(entry);\n return categoryName is not null ? new StringEntryBucket(GetCategoryName(entry)) : null;\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":827,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56424,"string":"56,424"},"pr_title":{"kind":"string","value":"EnC/HR interface unification"},"pr_description":{"kind":"string","value":"Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"author":{"kind":"string","value":"tmat"},"date_created":{"kind":"timestamp","value":"2021-09-15T22:22:11Z","string":"2021-09-15T22:22:11Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T16:03:37Z","string":"2021-09-21T16:03:37Z"},"previous_commit":{"kind":"string","value":"8574e338076f0a2d7a4bc0d129f00e7440e47fbb"},"pr_commit":{"kind":"string","value":"240a47028f8518833271b026667f18f2c02fcbd8"},"query":{"kind":"string","value":"EnC/HR interface unification. Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Portable/UseSiteDiagnosticsCheckEnforcer/Run.bat"},"before_content":{"kind":"string","value":"REM Licensed to the .NET Foundation under one or more agreements.\nREM The .NET Foundation licenses this file to you under the MIT license.\nREM See the LICENSE file in the project root for more information.\n\n\n@REM %1 - OutDir\n@REM %2 - TargetFileName\n@REM %3 - TargetPath \n@REM %4 - ProjectDir\n@REM %5 - ILDASMPath\n\n@REM @echo %1\n@REM @echo %2\n@REM @echo %3\n@REM @echo %4\n@REM @echo %5\n\n@echo Begin \"%4UseSiteDiagnosticsCheckEnforcer\\Run.bat\" %1 %2 %3 %4 %5 \n\n@set WorkFolder=\"%1%CSUseSiteChecks\"\n@set ILFileName=\"%2%.il\"\n@set TargetPath=\"%3%\"\n@set BaseLine=\"%4%UseSiteDiagnosticsCheckEnforcer\\BaseLine.txt\"\n@set ILDASMPath=%5% \n\n@IF NOT EXIST %WorkFolder% (\n @goto label_md\n)\n\n@rd /S /Q %WorkFolder%\n@IF ERRORLEVEL 1 (\n @goto label_rdFailed\n)\n\n:label_md\n@md %WorkFolder%\n\n@IF ERRORLEVEL 1 (\n @goto label_mdFailed\n)\n\n@pushd %WorkFolder%\n\n@%ILDASMPath% /NOBAR /OUT=%ILFileName% %TargetPath%\n\n@IF ERRORLEVEL 1 (\n @goto label_ildasmFailed\n)\n\n@findstr /C:Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol::get_BaseType() %ILFileName% > Found.txt\n@findstr /C:Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol::get_Interfaces() %ILFileName% >> Found.txt\n@findstr /C:Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol::get_AllInterfaces() %ILFileName% >> Found.txt\n@findstr /C:Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol::get_TypeArguments() %ILFileName% >> Found.txt\n@findstr /C:Microsoft.CodeAnalysis.CSharp.Symbols.TypeParameterSymbol::get_ConstraintTypes() %ILFileName% >> Found.txt\n\n@REM notepad Found.txt\n\n@fc %BaseLine% Found.txt > ComparisonResult.txt\n\n@IF ERRORLEVEL 1 (\n @goto label_baselineMismatch\n)\n\n@popd\n@rd /S /Q %WorkFolder%\n@echo End \"%4%UseSiteDiagnosticsCheckEnforcer\\Run.bat\"\n@EXIT /B 0\n\n:label_baselineMismatch\n@ECHO ********** Unexpected IL content in %TargetPath%\n@TYPE ComparisonResult.txt\n@ECHO ********** \n@popd\n@rd /S /Q %WorkFolder%\n@EXIT /B 1\n\n:label_ildasmFailed\n@ECHO ILDASM failed for: %TargetPath%\n@echo %ILDASMPath% /NOBAR /OUT=%ILFileName% %TargetPath% \n@popd\n@rd /S /Q %WorkFolder%\n@EXIT /B 1\n\n:label_rdFailed\n@ECHO Failed to delete temporary working folder: \"%WorkFolder%\"\n@EXIT /B 1\n\n:label_mdFailed\n@ECHO Failed to create temporary working folder: \"%WorkFolder%\"\n@EXIT /B 1\n"},"after_content":{"kind":"string","value":"REM Licensed to the .NET Foundation under one or more agreements.\nREM The .NET Foundation licenses this file to you under the MIT license.\nREM See the LICENSE file in the project root for more information.\n\n\n@REM %1 - OutDir\n@REM %2 - TargetFileName\n@REM %3 - TargetPath \n@REM %4 - ProjectDir\n@REM %5 - ILDASMPath\n\n@REM @echo %1\n@REM @echo %2\n@REM @echo %3\n@REM @echo %4\n@REM @echo %5\n\n@echo Begin \"%4UseSiteDiagnosticsCheckEnforcer\\Run.bat\" %1 %2 %3 %4 %5 \n\n@set WorkFolder=\"%1%CSUseSiteChecks\"\n@set ILFileName=\"%2%.il\"\n@set TargetPath=\"%3%\"\n@set BaseLine=\"%4%UseSiteDiagnosticsCheckEnforcer\\BaseLine.txt\"\n@set ILDASMPath=%5% \n\n@IF NOT EXIST %WorkFolder% (\n @goto label_md\n)\n\n@rd /S /Q %WorkFolder%\n@IF ERRORLEVEL 1 (\n @goto label_rdFailed\n)\n\n:label_md\n@md %WorkFolder%\n\n@IF ERRORLEVEL 1 (\n @goto label_mdFailed\n)\n\n@pushd %WorkFolder%\n\n@%ILDASMPath% /NOBAR /OUT=%ILFileName% %TargetPath%\n\n@IF ERRORLEVEL 1 (\n @goto label_ildasmFailed\n)\n\n@findstr /C:Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol::get_BaseType() %ILFileName% > Found.txt\n@findstr /C:Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol::get_Interfaces() %ILFileName% >> Found.txt\n@findstr /C:Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol::get_AllInterfaces() %ILFileName% >> Found.txt\n@findstr /C:Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol::get_TypeArguments() %ILFileName% >> Found.txt\n@findstr /C:Microsoft.CodeAnalysis.CSharp.Symbols.TypeParameterSymbol::get_ConstraintTypes() %ILFileName% >> Found.txt\n\n@REM notepad Found.txt\n\n@fc %BaseLine% Found.txt > ComparisonResult.txt\n\n@IF ERRORLEVEL 1 (\n @goto label_baselineMismatch\n)\n\n@popd\n@rd /S /Q %WorkFolder%\n@echo End \"%4%UseSiteDiagnosticsCheckEnforcer\\Run.bat\"\n@EXIT /B 0\n\n:label_baselineMismatch\n@ECHO ********** Unexpected IL content in %TargetPath%\n@TYPE ComparisonResult.txt\n@ECHO ********** \n@popd\n@rd /S /Q %WorkFolder%\n@EXIT /B 1\n\n:label_ildasmFailed\n@ECHO ILDASM failed for: %TargetPath%\n@echo %ILDASMPath% /NOBAR /OUT=%ILFileName% %TargetPath% \n@popd\n@rd /S /Q %WorkFolder%\n@EXIT /B 1\n\n:label_rdFailed\n@ECHO Failed to delete temporary working folder: \"%WorkFolder%\"\n@EXIT /B 1\n\n:label_mdFailed\n@ECHO Failed to create temporary working folder: \"%WorkFolder%\"\n@EXIT /B 1\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":828,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56424,"string":"56,424"},"pr_title":{"kind":"string","value":"EnC/HR interface unification"},"pr_description":{"kind":"string","value":"Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"author":{"kind":"string","value":"tmat"},"date_created":{"kind":"timestamp","value":"2021-09-15T22:22:11Z","string":"2021-09-15T22:22:11Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T16:03:37Z","string":"2021-09-21T16:03:37Z"},"previous_commit":{"kind":"string","value":"8574e338076f0a2d7a4bc0d129f00e7440e47fbb"},"pr_commit":{"kind":"string","value":"240a47028f8518833271b026667f18f2c02fcbd8"},"query":{"kind":"string","value":"EnC/HR interface unification. Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Portable/Emitter/Model/SpecializedGenericNestedTypeInstanceReference.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Collections.Immutable;\nusing Microsoft.CodeAnalysis.CSharp.Symbols;\nusing Microsoft.CodeAnalysis.Emit;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing System.Diagnostics;\nusing System.Linq;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Emit\n{\n /// \n /// Represents a reference to an instantiation of a generic type nested in an instantiation of another generic type.\n /// e.g. \n /// A{int}.B{string}\n /// A.B{int}.C.D{string}\n /// \n internal sealed class SpecializedGenericNestedTypeInstanceReference : SpecializedNestedTypeReference, Cci.IGenericTypeInstanceReference\n {\n public SpecializedGenericNestedTypeInstanceReference(NamedTypeSymbol underlyingNamedType)\n : base(underlyingNamedType)\n {\n Debug.Assert(underlyingNamedType.IsDefinition);\n // Definition doesn't have custom modifiers on type arguments\n Debug.Assert(!underlyingNamedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Any(a => a.CustomModifiers.Any()));\n }\n\n public sealed override void Dispatch(Cci.MetadataVisitor visitor)\n {\n visitor.Visit((Cci.IGenericTypeInstanceReference)this);\n }\n\n ImmutableArray Cci.IGenericTypeInstanceReference.GetGenericArguments(EmitContext context)\n {\n PEModuleBuilder moduleBeingBuilt = (PEModuleBuilder)context.Module;\n var builder = ArrayBuilder.GetInstance();\n foreach (TypeWithAnnotations type in UnderlyingNamedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics)\n {\n builder.Add(moduleBeingBuilt.Translate(type.Type, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNode, diagnostics: context.Diagnostics));\n }\n\n return builder.ToImmutableAndFree();\n }\n\n Cci.INamedTypeReference Cci.IGenericTypeInstanceReference.GetGenericType(EmitContext context)\n {\n System.Diagnostics.Debug.Assert(UnderlyingNamedType.OriginalDefinition.IsDefinition);\n PEModuleBuilder moduleBeingBuilt = (PEModuleBuilder)context.Module;\n return moduleBeingBuilt.Translate(this.UnderlyingNamedType.OriginalDefinition, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNode,\n diagnostics: context.Diagnostics, needDeclaration: true);\n }\n\n public override Cci.IGenericTypeInstanceReference AsGenericTypeInstanceReference\n {\n get { return this; }\n }\n\n public override Cci.INamespaceTypeReference AsNamespaceTypeReference\n {\n get { return null; }\n }\n\n public override Cci.INestedTypeReference AsNestedTypeReference\n {\n get { return this; }\n }\n\n public override Cci.ISpecializedNestedTypeReference AsSpecializedNestedTypeReference\n {\n get { return null; }\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Collections.Immutable;\nusing Microsoft.CodeAnalysis.CSharp.Symbols;\nusing Microsoft.CodeAnalysis.Emit;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing System.Diagnostics;\nusing System.Linq;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Emit\n{\n /// \n /// Represents a reference to an instantiation of a generic type nested in an instantiation of another generic type.\n /// e.g. \n /// A{int}.B{string}\n /// A.B{int}.C.D{string}\n /// \n internal sealed class SpecializedGenericNestedTypeInstanceReference : SpecializedNestedTypeReference, Cci.IGenericTypeInstanceReference\n {\n public SpecializedGenericNestedTypeInstanceReference(NamedTypeSymbol underlyingNamedType)\n : base(underlyingNamedType)\n {\n Debug.Assert(underlyingNamedType.IsDefinition);\n // Definition doesn't have custom modifiers on type arguments\n Debug.Assert(!underlyingNamedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Any(a => a.CustomModifiers.Any()));\n }\n\n public sealed override void Dispatch(Cci.MetadataVisitor visitor)\n {\n visitor.Visit((Cci.IGenericTypeInstanceReference)this);\n }\n\n ImmutableArray Cci.IGenericTypeInstanceReference.GetGenericArguments(EmitContext context)\n {\n PEModuleBuilder moduleBeingBuilt = (PEModuleBuilder)context.Module;\n var builder = ArrayBuilder.GetInstance();\n foreach (TypeWithAnnotations type in UnderlyingNamedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics)\n {\n builder.Add(moduleBeingBuilt.Translate(type.Type, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNode, diagnostics: context.Diagnostics));\n }\n\n return builder.ToImmutableAndFree();\n }\n\n Cci.INamedTypeReference Cci.IGenericTypeInstanceReference.GetGenericType(EmitContext context)\n {\n System.Diagnostics.Debug.Assert(UnderlyingNamedType.OriginalDefinition.IsDefinition);\n PEModuleBuilder moduleBeingBuilt = (PEModuleBuilder)context.Module;\n return moduleBeingBuilt.Translate(this.UnderlyingNamedType.OriginalDefinition, syntaxNodeOpt: (CSharpSyntaxNode)context.SyntaxNode,\n diagnostics: context.Diagnostics, needDeclaration: true);\n }\n\n public override Cci.IGenericTypeInstanceReference AsGenericTypeInstanceReference\n {\n get { return this; }\n }\n\n public override Cci.INamespaceTypeReference AsNamespaceTypeReference\n {\n get { return null; }\n }\n\n public override Cci.INestedTypeReference AsNestedTypeReference\n {\n get { return this; }\n }\n\n public override Cci.ISpecializedNestedTypeReference AsSpecializedNestedTypeReference\n {\n get { return null; }\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":829,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56424,"string":"56,424"},"pr_title":{"kind":"string","value":"EnC/HR interface unification"},"pr_description":{"kind":"string","value":"Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"author":{"kind":"string","value":"tmat"},"date_created":{"kind":"timestamp","value":"2021-09-15T22:22:11Z","string":"2021-09-15T22:22:11Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T16:03:37Z","string":"2021-09-21T16:03:37Z"},"previous_commit":{"kind":"string","value":"8574e338076f0a2d7a4bc0d129f00e7440e47fbb"},"pr_commit":{"kind":"string","value":"240a47028f8518833271b026667f18f2c02fcbd8"},"query":{"kind":"string","value":"EnC/HR interface unification. Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"filepath":{"kind":"string","value":"./src/VisualStudio/Core/Def/Implementation/Workspace/GlobalUndoServiceFactory.WorkspaceGlobalUndoTransaction.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Diagnostics;\nusing System.Runtime.InteropServices;\nusing System.Threading;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.Editor.Shared.Utilities;\nusing Microsoft.CodeAnalysis.Editor.Undo;\nusing Microsoft.CodeAnalysis.Text;\nusing Microsoft.VisualStudio;\nusing Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;\nusing Microsoft.VisualStudio.Text.Operations;\nusing Microsoft.VisualStudio.TextManager.Interop;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.VisualStudio.LanguageServices.Implementation\n{\n using Workspace = Microsoft.CodeAnalysis.Workspace;\n\n internal partial class GlobalUndoServiceFactory\n {\n private class WorkspaceUndoTransaction : ForegroundThreadAffinitizedObject, IWorkspaceGlobalUndoTransaction\n {\n private readonly ITextUndoHistoryRegistry _undoHistoryRegistry;\n private readonly IVsLinkedUndoTransactionManager _undoManager;\n private readonly Workspace _workspace;\n private readonly string _description;\n private readonly GlobalUndoService _service;\n\n // indicate whether undo transaction is currently active\n private bool _transactionAlive;\n\n public WorkspaceUndoTransaction(\n IThreadingContext threadingContext,\n ITextUndoHistoryRegistry undoHistoryRegistry,\n IVsLinkedUndoTransactionManager undoManager,\n Workspace workspace,\n string description,\n GlobalUndoService service)\n : base(threadingContext, assertIsForeground: true)\n {\n _undoHistoryRegistry = undoHistoryRegistry;\n _undoManager = undoManager;\n _workspace = workspace;\n _description = description;\n _service = service;\n\n Marshal.ThrowExceptionForHR(_undoManager.OpenLinkedUndo((uint)LinkedTransactionFlags2.mdtGlobal, _description));\n _transactionAlive = true;\n }\n\n public void AddDocument(DocumentId id)\n {\n var visualStudioWorkspace = (VisualStudioWorkspace)_workspace;\n Contract.ThrowIfNull(visualStudioWorkspace);\n\n var solution = visualStudioWorkspace.CurrentSolution;\n var document = solution.GetDocument(id);\n if (document == null)\n {\n // document is not part of the workspace (newly created document that is not applied to the workspace yet?)\n return;\n }\n\n if (visualStudioWorkspace.IsDocumentOpen(id))\n {\n var container = document.GetTextAsync().WaitAndGetResult(CancellationToken.None).Container;\n var textBuffer = container.TryGetTextBuffer();\n var undoHistory = _undoHistoryRegistry.RegisterHistory(textBuffer);\n\n using var undoTransaction = undoHistory.CreateTransaction(_description);\n undoTransaction.AddUndo(new NoOpUndoPrimitive());\n undoTransaction.Complete();\n }\n else\n {\n // open and close the document so that it is included in the global undo transaction\n using (visualStudioWorkspace.OpenInvisibleEditor(id))\n {\n // empty\n }\n }\n }\n\n public void Commit()\n {\n AssertIsForeground();\n\n // once either commit or disposed is called, don't do finalizer check\n GC.SuppressFinalize(this);\n\n if (_transactionAlive)\n {\n _service.ActiveTransactions--;\n\n var result = _undoManager.CloseLinkedUndo();\n if (result == VSConstants.UNDO_E_CLIENTABORT)\n {\n Dispose();\n }\n else\n {\n Marshal.ThrowExceptionForHR(result);\n _transactionAlive = false;\n }\n }\n }\n\n public void Dispose()\n {\n AssertIsForeground();\n\n // once either commit or disposed is called, don't do finalizer check\n GC.SuppressFinalize(this);\n\n if (_transactionAlive)\n {\n _service.ActiveTransactions--;\n\n Marshal.ThrowExceptionForHR(_undoManager.AbortLinkedUndo());\n _transactionAlive = false;\n }\n }\n\n#if DEBUG\n ~WorkspaceUndoTransaction()\n {\n // make sure we closed it correctly\n Debug.Assert(!_transactionAlive);\n }\n#endif\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Diagnostics;\nusing System.Runtime.InteropServices;\nusing System.Threading;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.Editor.Shared.Utilities;\nusing Microsoft.CodeAnalysis.Editor.Undo;\nusing Microsoft.CodeAnalysis.Text;\nusing Microsoft.VisualStudio;\nusing Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;\nusing Microsoft.VisualStudio.Text.Operations;\nusing Microsoft.VisualStudio.TextManager.Interop;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.VisualStudio.LanguageServices.Implementation\n{\n using Workspace = Microsoft.CodeAnalysis.Workspace;\n\n internal partial class GlobalUndoServiceFactory\n {\n private class WorkspaceUndoTransaction : ForegroundThreadAffinitizedObject, IWorkspaceGlobalUndoTransaction\n {\n private readonly ITextUndoHistoryRegistry _undoHistoryRegistry;\n private readonly IVsLinkedUndoTransactionManager _undoManager;\n private readonly Workspace _workspace;\n private readonly string _description;\n private readonly GlobalUndoService _service;\n\n // indicate whether undo transaction is currently active\n private bool _transactionAlive;\n\n public WorkspaceUndoTransaction(\n IThreadingContext threadingContext,\n ITextUndoHistoryRegistry undoHistoryRegistry,\n IVsLinkedUndoTransactionManager undoManager,\n Workspace workspace,\n string description,\n GlobalUndoService service)\n : base(threadingContext, assertIsForeground: true)\n {\n _undoHistoryRegistry = undoHistoryRegistry;\n _undoManager = undoManager;\n _workspace = workspace;\n _description = description;\n _service = service;\n\n Marshal.ThrowExceptionForHR(_undoManager.OpenLinkedUndo((uint)LinkedTransactionFlags2.mdtGlobal, _description));\n _transactionAlive = true;\n }\n\n public void AddDocument(DocumentId id)\n {\n var visualStudioWorkspace = (VisualStudioWorkspace)_workspace;\n Contract.ThrowIfNull(visualStudioWorkspace);\n\n var solution = visualStudioWorkspace.CurrentSolution;\n var document = solution.GetDocument(id);\n if (document == null)\n {\n // document is not part of the workspace (newly created document that is not applied to the workspace yet?)\n return;\n }\n\n if (visualStudioWorkspace.IsDocumentOpen(id))\n {\n var container = document.GetTextAsync().WaitAndGetResult(CancellationToken.None).Container;\n var textBuffer = container.TryGetTextBuffer();\n var undoHistory = _undoHistoryRegistry.RegisterHistory(textBuffer);\n\n using var undoTransaction = undoHistory.CreateTransaction(_description);\n undoTransaction.AddUndo(new NoOpUndoPrimitive());\n undoTransaction.Complete();\n }\n else\n {\n // open and close the document so that it is included in the global undo transaction\n using (visualStudioWorkspace.OpenInvisibleEditor(id))\n {\n // empty\n }\n }\n }\n\n public void Commit()\n {\n AssertIsForeground();\n\n // once either commit or disposed is called, don't do finalizer check\n GC.SuppressFinalize(this);\n\n if (_transactionAlive)\n {\n _service.ActiveTransactions--;\n\n var result = _undoManager.CloseLinkedUndo();\n if (result == VSConstants.UNDO_E_CLIENTABORT)\n {\n Dispose();\n }\n else\n {\n Marshal.ThrowExceptionForHR(result);\n _transactionAlive = false;\n }\n }\n }\n\n public void Dispose()\n {\n AssertIsForeground();\n\n // once either commit or disposed is called, don't do finalizer check\n GC.SuppressFinalize(this);\n\n if (_transactionAlive)\n {\n _service.ActiveTransactions--;\n\n Marshal.ThrowExceptionForHR(_undoManager.AbortLinkedUndo());\n _transactionAlive = false;\n }\n }\n\n#if DEBUG\n ~WorkspaceUndoTransaction()\n {\n // make sure we closed it correctly\n Debug.Assert(!_transactionAlive);\n }\n#endif\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":830,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56424,"string":"56,424"},"pr_title":{"kind":"string","value":"EnC/HR interface unification"},"pr_description":{"kind":"string","value":"Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"author":{"kind":"string","value":"tmat"},"date_created":{"kind":"timestamp","value":"2021-09-15T22:22:11Z","string":"2021-09-15T22:22:11Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T16:03:37Z","string":"2021-09-21T16:03:37Z"},"previous_commit":{"kind":"string","value":"8574e338076f0a2d7a4bc0d129f00e7440e47fbb"},"pr_commit":{"kind":"string","value":"240a47028f8518833271b026667f18f2c02fcbd8"},"query":{"kind":"string","value":"EnC/HR interface unification. Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"filepath":{"kind":"string","value":"./src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Metadata/PE/LoadingFields.vb"},"before_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Runtime.CompilerServices\nImports CompilationCreationTestHelpers\nImports Microsoft.CodeAnalysis.Test.Utilities\nImports Microsoft.CodeAnalysis.Text\nImports Microsoft.CodeAnalysis.VisualBasic\nImports Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE\nImports Microsoft.CodeAnalysis.VisualBasic.Symbols\nImports Microsoft.CodeAnalysis.VisualBasic.Syntax\nImports Roslyn.Test.Utilities\n\nNamespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols.Metadata.PE\n\n Public Class LoadingFields : Inherits BasicTestBase\n\n \n Public Sub Test1()\n Dim assemblies = MetadataTestHelpers.GetSymbolsForReferences(\n {\n TestResources.SymbolsTests.Fields.CSFields,\n TestResources.SymbolsTests.Fields.VBFields,\n TestMetadata.ResourcesNet40.mscorlib\n }, importInternals:=True)\n\n Dim module1 = assemblies(0).Modules(0)\n Dim module2 = assemblies(1).Modules(0)\n Dim module3 = assemblies(2).Modules(0)\n\n Dim vbFields = module2.GlobalNamespace.GetTypeMembers(\"VBFields\").Single()\n Dim csFields = module1.GlobalNamespace.GetTypeMembers(\"CSFields\").Single()\n\n Dim f1 = DirectCast(vbFields.GetMembers(\"F1\").Single(), FieldSymbol)\n Dim f2 = DirectCast(vbFields.GetMembers(\"F2\").Single(), FieldSymbol)\n Dim f3 = DirectCast(vbFields.GetMembers(\"F3\").Single(), FieldSymbol)\n Dim f4 = DirectCast(vbFields.GetMembers(\"F4\").Single(), FieldSymbol)\n Dim f5 = DirectCast(vbFields.GetMembers(\"F5\").Single(), FieldSymbol)\n Dim f6 = DirectCast(csFields.GetMembers(\"F6\").Single(), FieldSymbol)\n\n Assert.Equal(\"F1\", f1.Name)\n Assert.Same(vbFields.TypeParameters(0), f1.Type)\n Assert.False(f1.IsMustOverride)\n Assert.False(f1.IsConst)\n Assert.True(f1.IsDefinition)\n Assert.False(f1.IsOverrides)\n Assert.False(f1.IsReadOnly)\n Assert.False(f1.IsNotOverridable)\n Assert.True(f1.IsShared)\n Assert.False(f1.IsOverridable)\n Assert.Equal(SymbolKind.Field, f1.Kind)\n Assert.Equal(module2.Locations, f1.Locations)\n Assert.Same(f1, f1.OriginalDefinition)\n Assert.Equal(Accessibility.Public, f1.DeclaredAccessibility)\n Assert.Same(vbFields, f1.ContainingSymbol)\n Assert.Equal(0, f1.CustomModifiers.Length)\n\n Assert.Equal(\"F2\", f2.Name)\n Assert.Same(DirectCast(module2, PEModuleSymbol).GetCorLibType(SpecialType.System_Int32), f2.Type)\n Assert.False(f2.IsConst)\n Assert.True(f2.IsReadOnly)\n Assert.False(f2.IsShared)\n Assert.Equal(Accessibility.Protected, f2.DeclaredAccessibility)\n Assert.Equal(0, f2.CustomModifiers.Length)\n\n Assert.Equal(\"F3\", f3.Name)\n Assert.False(f3.IsConst)\n Assert.False(f3.IsReadOnly)\n Assert.False(f3.IsShared)\n Assert.Equal(Accessibility.Friend, f3.DeclaredAccessibility)\n Assert.Equal(0, f3.CustomModifiers.Length)\n\n Assert.Equal(\"F4\", f4.Name)\n Assert.False(f4.IsConst)\n Assert.False(f4.IsReadOnly)\n Assert.False(f4.IsShared)\n Assert.Equal(Accessibility.ProtectedOrFriend, f4.DeclaredAccessibility)\n Assert.Equal(0, f4.CustomModifiers.Length)\n\n Assert.Equal(\"F5\", f5.Name)\n Assert.True(f5.IsConst)\n Assert.False(f5.IsReadOnly)\n Assert.True(f5.IsShared)\n Assert.Equal(Accessibility.Protected, f5.DeclaredAccessibility)\n Assert.Equal(0, f5.CustomModifiers.Length)\n\n Assert.Equal(\"F6\", f6.Name)\n Assert.False(f6.IsConst)\n Assert.False(f6.IsReadOnly)\n Assert.False(f6.IsShared)\n Assert.False(f6.CustomModifiers.Single().IsOptional)\n Assert.Equal(\"System.Runtime.CompilerServices.IsVolatile\", f6.CustomModifiers.Single().Modifier.ToTestDisplayString())\n Assert.True(f6.HasUnsupportedMetadata)\n\n Assert.Equal(3, csFields.GetMembers(\"FFF\").Length())\n Assert.Equal(3, csFields.GetMembers(\"Fff\").Length())\n Assert.Equal(3, csFields.GetMembers(\"FfF\").Length())\n End Sub\n\n \n Public Sub ConstantFields()\n Dim assemblies = MetadataTestHelpers.GetSymbolsForReferences(\n {\n TestResources.SymbolsTests.Fields.ConstantFields,\n TestMetadata.ResourcesNet40.mscorlib\n })\n\n Dim module1 = assemblies(0).Modules(0)\n\n Dim ConstFields = module1.GlobalNamespace.GetTypeMembers(\"ConstFields\").Single()\n\n Dim ByteEnum = module1.GlobalNamespace.GetTypeMembers(\"ByteEnum\").Single()\n Dim SByteEnum = module1.GlobalNamespace.GetTypeMembers(\"SByteEnum\").Single()\n Dim UInt16Enum = module1.GlobalNamespace.GetTypeMembers(\"UInt16Enum\").Single()\n Dim Int16Enum = module1.GlobalNamespace.GetTypeMembers(\"Int16Enum\").Single()\n Dim UInt32Enum = module1.GlobalNamespace.GetTypeMembers(\"UInt32Enum\").Single()\n Dim Int32Enum = module1.GlobalNamespace.GetTypeMembers(\"Int32Enum\").Single()\n Dim UInt64Enum = module1.GlobalNamespace.GetTypeMembers(\"UInt64Enum\").Single()\n Dim Int64Enum = module1.GlobalNamespace.GetTypeMembers(\"Int64Enum\").Single()\n\n 'Public Const Int64Field As Long = 634315546432909307\n 'Public DateTimeField As DateTime\n 'Public Const SingleField As Single = 9\n 'Public Const DoubleField As Double = -10\n 'Public Const StringField As String = \"11\"\n 'Public Const StringNullField As String = Nothing\n 'Public Const ObjectNullField As Object = Nothing\n\n Dim Int64Field = DirectCast(ConstFields.GetMembers(\"Int64Field\").Single(), FieldSymbol)\n Dim DateTimeField = DirectCast(ConstFields.GetMembers(\"DateTimeField\").Single(), FieldSymbol)\n Dim SingleField = DirectCast(ConstFields.GetMembers(\"SingleField\").Single(), FieldSymbol)\n Dim DoubleField = DirectCast(ConstFields.GetMembers(\"DoubleField\").Single(), FieldSymbol)\n Dim StringField = DirectCast(ConstFields.GetMembers(\"StringField\").Single(), FieldSymbol)\n Dim StringNullField = DirectCast(ConstFields.GetMembers(\"StringNullField\").Single(), FieldSymbol)\n Dim ObjectNullField = DirectCast(ConstFields.GetMembers(\"ObjectNullField\").Single(), FieldSymbol)\n\n Assert.True(Int64Field.IsConst)\n Assert.True(Int64Field.HasConstantValue)\n Assert.Equal(Int64Field.ConstantValue, 634315546432909307)\n Assert.Equal(ConstantValueTypeDiscriminator.Int64, Int64Field.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(634315546432909307, Int64Field.GetConstantValue(ConstantFieldsInProgress.Empty).Int64Value)\n\n Assert.True(DateTimeField.IsConst)\n Assert.True(DateTimeField.HasConstantValue)\n Assert.Equal(DateTimeField.ConstantValue, New DateTime(634315546432909307))\n Assert.Equal(ConstantValueTypeDiscriminator.DateTime, DateTimeField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(New DateTime(634315546432909307), DateTimeField.GetConstantValue(ConstantFieldsInProgress.Empty).DateTimeValue)\n\n Assert.True(SingleField.IsConst)\n Assert.True(SingleField.HasConstantValue)\n Assert.Equal(SingleField.ConstantValue, 9.0F)\n Assert.Equal(ConstantValueTypeDiscriminator.Single, SingleField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(9.0F, SingleField.GetConstantValue(ConstantFieldsInProgress.Empty).SingleValue)\n\n Assert.True(DoubleField.IsConst)\n Assert.True(DoubleField.HasConstantValue)\n Assert.Equal(DoubleField.ConstantValue, -10.0)\n Assert.Equal(ConstantValueTypeDiscriminator.Double, DoubleField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(-10.0, DoubleField.GetConstantValue(ConstantFieldsInProgress.Empty).DoubleValue)\n\n Assert.True(StringField.IsConst)\n Assert.True(StringField.HasConstantValue)\n Assert.Equal(StringField.ConstantValue, \"11\")\n Assert.Equal(ConstantValueTypeDiscriminator.String, StringField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(\"11\", StringField.GetConstantValue(ConstantFieldsInProgress.Empty).StringValue)\n\n Assert.True(StringNullField.IsConst)\n Assert.True(StringNullField.HasConstantValue)\n Assert.Null(StringNullField.ConstantValue)\n Assert.Equal(ConstantValueTypeDiscriminator.Nothing, StringNullField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n\n Assert.True(ObjectNullField.IsConst)\n Assert.True(ObjectNullField.HasConstantValue)\n Assert.Null(ObjectNullField.ConstantValue)\n Assert.Equal(ConstantValueTypeDiscriminator.Nothing, ObjectNullField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n\n\n 'ByteValue = 1\n 'SByteValue = -2\n 'UInt16Value = 3\n 'Int16Value = -4\n 'UInt32Value = 5\n 'Int32Value = -6\n 'UInt64Value = 7\n 'Int64Value = -8\n\n Dim ByteValue = DirectCast(ByteEnum.GetMembers(\"ByteValue\").Single(), FieldSymbol)\n Dim SByteValue = DirectCast(SByteEnum.GetMembers(\"SByteValue\").Single(), FieldSymbol)\n Dim UInt16Value = DirectCast(UInt16Enum.GetMembers(\"UInt16Value\").Single(), FieldSymbol)\n Dim Int16Value = DirectCast(Int16Enum.GetMembers(\"Int16Value\").Single(), FieldSymbol)\n Dim UInt32Value = DirectCast(UInt32Enum.GetMembers(\"UInt32Value\").Single(), FieldSymbol)\n Dim Int32Value = DirectCast(Int32Enum.GetMembers(\"Int32Value\").Single(), FieldSymbol)\n Dim UInt64Value = DirectCast(UInt64Enum.GetMembers(\"UInt64Value\").Single(), FieldSymbol)\n Dim Int64Value = DirectCast(Int64Enum.GetMembers(\"Int64Value\").Single(), FieldSymbol)\n\n Assert.True(ByteValue.IsConst)\n Assert.True(ByteValue.HasConstantValue)\n Assert.Equal(ByteValue.ConstantValue, CByte(1))\n Assert.Equal(ConstantValueTypeDiscriminator.Byte, ByteValue.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(CByte(1), ByteValue.GetConstantValue(ConstantFieldsInProgress.Empty).ByteValue)\n\n Assert.True(SByteValue.IsConst)\n Assert.True(SByteValue.HasConstantValue)\n Assert.Equal(SByteValue.ConstantValue, CSByte(-2))\n Assert.Equal(ConstantValueTypeDiscriminator.SByte, SByteValue.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(CSByte(-2), SByteValue.GetConstantValue(ConstantFieldsInProgress.Empty).SByteValue)\n\n Assert.True(UInt16Value.IsConst)\n Assert.True(UInt16Value.HasConstantValue)\n Assert.Equal(UInt16Value.ConstantValue, 3US)\n Assert.Equal(ConstantValueTypeDiscriminator.UInt16, UInt16Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(3US, UInt16Value.GetConstantValue(ConstantFieldsInProgress.Empty).UInt16Value)\n\n Assert.True(Int16Value.IsConst)\n Assert.True(Int16Value.HasConstantValue)\n Assert.Equal(Int16Value.ConstantValue, -4S)\n Assert.Equal(ConstantValueTypeDiscriminator.Int16, Int16Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(-4S, Int16Value.GetConstantValue(ConstantFieldsInProgress.Empty).Int16Value)\n\n Assert.True(UInt32Value.IsConst)\n Assert.True(UInt32Value.HasConstantValue)\n Assert.Equal(UInt32Value.ConstantValue, 5UI)\n Assert.Equal(ConstantValueTypeDiscriminator.UInt32, UInt32Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(5UI, UInt32Value.GetConstantValue(ConstantFieldsInProgress.Empty).UInt32Value)\n\n Assert.True(Int32Value.IsConst)\n Assert.True(Int32Value.HasConstantValue)\n Assert.Equal(Int32Value.ConstantValue, -6)\n Assert.Equal(ConstantValueTypeDiscriminator.Int32, Int32Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(-6, Int32Value.GetConstantValue(ConstantFieldsInProgress.Empty).Int32Value)\n\n Assert.True(UInt64Value.IsConst)\n Assert.True(UInt64Value.HasConstantValue)\n Assert.Equal(UInt64Value.ConstantValue, 7UL)\n Assert.Equal(ConstantValueTypeDiscriminator.UInt64, UInt64Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(7UL, UInt64Value.GetConstantValue(ConstantFieldsInProgress.Empty).UInt64Value)\n\n Assert.True(Int64Value.IsConst)\n Assert.True(Int64Value.HasConstantValue)\n Assert.Equal(Int64Value.ConstantValue, -8L)\n Assert.Equal(ConstantValueTypeDiscriminator.Int64, Int64Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(-8L, Int64Value.GetConstantValue(ConstantFieldsInProgress.Empty).Int64Value)\n End Sub\n\n \n \n Public Sub EnumWithPrivateValueField()\n\n Dim ilSource = \"\n.class public auto ansi sealed TestEnum\n extends [mscorlib]System.Enum\n{\n .field private specialname rtspecialname int32 value__\n .field public static literal valuetype TestEnum Value1 = int32(0x00000000)\n .field public static literal valuetype TestEnum Value2 = int32(0x00000001)\n} // end of class TestEnum\n\"\n\n Dim vbSource =\n\n \nModule Module1\n Sub Main()\n Dim val as TestEnum = TestEnum.Value1\n System.Console.WriteLine(val.ToString())\n val = TestEnum.Value2\n System.Console.WriteLine(val.ToString())\n End Sub\nEnd Module\n \n\n\n Dim compilation = CreateCompilationWithCustomILSource(vbSource, ilSource, includeVbRuntime:=True, options:=TestOptions.DebugExe)\n\n CompileAndVerify(compilation, expectedOutput:=\"Value1\nValue2\")\n End Sub\n\n End Class\n\nEnd Namespace\n"},"after_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Runtime.CompilerServices\nImports CompilationCreationTestHelpers\nImports Microsoft.CodeAnalysis.Test.Utilities\nImports Microsoft.CodeAnalysis.Text\nImports Microsoft.CodeAnalysis.VisualBasic\nImports Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE\nImports Microsoft.CodeAnalysis.VisualBasic.Symbols\nImports Microsoft.CodeAnalysis.VisualBasic.Syntax\nImports Roslyn.Test.Utilities\n\nNamespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols.Metadata.PE\n\n Public Class LoadingFields : Inherits BasicTestBase\n\n \n Public Sub Test1()\n Dim assemblies = MetadataTestHelpers.GetSymbolsForReferences(\n {\n TestResources.SymbolsTests.Fields.CSFields,\n TestResources.SymbolsTests.Fields.VBFields,\n TestMetadata.ResourcesNet40.mscorlib\n }, importInternals:=True)\n\n Dim module1 = assemblies(0).Modules(0)\n Dim module2 = assemblies(1).Modules(0)\n Dim module3 = assemblies(2).Modules(0)\n\n Dim vbFields = module2.GlobalNamespace.GetTypeMembers(\"VBFields\").Single()\n Dim csFields = module1.GlobalNamespace.GetTypeMembers(\"CSFields\").Single()\n\n Dim f1 = DirectCast(vbFields.GetMembers(\"F1\").Single(), FieldSymbol)\n Dim f2 = DirectCast(vbFields.GetMembers(\"F2\").Single(), FieldSymbol)\n Dim f3 = DirectCast(vbFields.GetMembers(\"F3\").Single(), FieldSymbol)\n Dim f4 = DirectCast(vbFields.GetMembers(\"F4\").Single(), FieldSymbol)\n Dim f5 = DirectCast(vbFields.GetMembers(\"F5\").Single(), FieldSymbol)\n Dim f6 = DirectCast(csFields.GetMembers(\"F6\").Single(), FieldSymbol)\n\n Assert.Equal(\"F1\", f1.Name)\n Assert.Same(vbFields.TypeParameters(0), f1.Type)\n Assert.False(f1.IsMustOverride)\n Assert.False(f1.IsConst)\n Assert.True(f1.IsDefinition)\n Assert.False(f1.IsOverrides)\n Assert.False(f1.IsReadOnly)\n Assert.False(f1.IsNotOverridable)\n Assert.True(f1.IsShared)\n Assert.False(f1.IsOverridable)\n Assert.Equal(SymbolKind.Field, f1.Kind)\n Assert.Equal(module2.Locations, f1.Locations)\n Assert.Same(f1, f1.OriginalDefinition)\n Assert.Equal(Accessibility.Public, f1.DeclaredAccessibility)\n Assert.Same(vbFields, f1.ContainingSymbol)\n Assert.Equal(0, f1.CustomModifiers.Length)\n\n Assert.Equal(\"F2\", f2.Name)\n Assert.Same(DirectCast(module2, PEModuleSymbol).GetCorLibType(SpecialType.System_Int32), f2.Type)\n Assert.False(f2.IsConst)\n Assert.True(f2.IsReadOnly)\n Assert.False(f2.IsShared)\n Assert.Equal(Accessibility.Protected, f2.DeclaredAccessibility)\n Assert.Equal(0, f2.CustomModifiers.Length)\n\n Assert.Equal(\"F3\", f3.Name)\n Assert.False(f3.IsConst)\n Assert.False(f3.IsReadOnly)\n Assert.False(f3.IsShared)\n Assert.Equal(Accessibility.Friend, f3.DeclaredAccessibility)\n Assert.Equal(0, f3.CustomModifiers.Length)\n\n Assert.Equal(\"F4\", f4.Name)\n Assert.False(f4.IsConst)\n Assert.False(f4.IsReadOnly)\n Assert.False(f4.IsShared)\n Assert.Equal(Accessibility.ProtectedOrFriend, f4.DeclaredAccessibility)\n Assert.Equal(0, f4.CustomModifiers.Length)\n\n Assert.Equal(\"F5\", f5.Name)\n Assert.True(f5.IsConst)\n Assert.False(f5.IsReadOnly)\n Assert.True(f5.IsShared)\n Assert.Equal(Accessibility.Protected, f5.DeclaredAccessibility)\n Assert.Equal(0, f5.CustomModifiers.Length)\n\n Assert.Equal(\"F6\", f6.Name)\n Assert.False(f6.IsConst)\n Assert.False(f6.IsReadOnly)\n Assert.False(f6.IsShared)\n Assert.False(f6.CustomModifiers.Single().IsOptional)\n Assert.Equal(\"System.Runtime.CompilerServices.IsVolatile\", f6.CustomModifiers.Single().Modifier.ToTestDisplayString())\n Assert.True(f6.HasUnsupportedMetadata)\n\n Assert.Equal(3, csFields.GetMembers(\"FFF\").Length())\n Assert.Equal(3, csFields.GetMembers(\"Fff\").Length())\n Assert.Equal(3, csFields.GetMembers(\"FfF\").Length())\n End Sub\n\n \n Public Sub ConstantFields()\n Dim assemblies = MetadataTestHelpers.GetSymbolsForReferences(\n {\n TestResources.SymbolsTests.Fields.ConstantFields,\n TestMetadata.ResourcesNet40.mscorlib\n })\n\n Dim module1 = assemblies(0).Modules(0)\n\n Dim ConstFields = module1.GlobalNamespace.GetTypeMembers(\"ConstFields\").Single()\n\n Dim ByteEnum = module1.GlobalNamespace.GetTypeMembers(\"ByteEnum\").Single()\n Dim SByteEnum = module1.GlobalNamespace.GetTypeMembers(\"SByteEnum\").Single()\n Dim UInt16Enum = module1.GlobalNamespace.GetTypeMembers(\"UInt16Enum\").Single()\n Dim Int16Enum = module1.GlobalNamespace.GetTypeMembers(\"Int16Enum\").Single()\n Dim UInt32Enum = module1.GlobalNamespace.GetTypeMembers(\"UInt32Enum\").Single()\n Dim Int32Enum = module1.GlobalNamespace.GetTypeMembers(\"Int32Enum\").Single()\n Dim UInt64Enum = module1.GlobalNamespace.GetTypeMembers(\"UInt64Enum\").Single()\n Dim Int64Enum = module1.GlobalNamespace.GetTypeMembers(\"Int64Enum\").Single()\n\n 'Public Const Int64Field As Long = 634315546432909307\n 'Public DateTimeField As DateTime\n 'Public Const SingleField As Single = 9\n 'Public Const DoubleField As Double = -10\n 'Public Const StringField As String = \"11\"\n 'Public Const StringNullField As String = Nothing\n 'Public Const ObjectNullField As Object = Nothing\n\n Dim Int64Field = DirectCast(ConstFields.GetMembers(\"Int64Field\").Single(), FieldSymbol)\n Dim DateTimeField = DirectCast(ConstFields.GetMembers(\"DateTimeField\").Single(), FieldSymbol)\n Dim SingleField = DirectCast(ConstFields.GetMembers(\"SingleField\").Single(), FieldSymbol)\n Dim DoubleField = DirectCast(ConstFields.GetMembers(\"DoubleField\").Single(), FieldSymbol)\n Dim StringField = DirectCast(ConstFields.GetMembers(\"StringField\").Single(), FieldSymbol)\n Dim StringNullField = DirectCast(ConstFields.GetMembers(\"StringNullField\").Single(), FieldSymbol)\n Dim ObjectNullField = DirectCast(ConstFields.GetMembers(\"ObjectNullField\").Single(), FieldSymbol)\n\n Assert.True(Int64Field.IsConst)\n Assert.True(Int64Field.HasConstantValue)\n Assert.Equal(Int64Field.ConstantValue, 634315546432909307)\n Assert.Equal(ConstantValueTypeDiscriminator.Int64, Int64Field.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(634315546432909307, Int64Field.GetConstantValue(ConstantFieldsInProgress.Empty).Int64Value)\n\n Assert.True(DateTimeField.IsConst)\n Assert.True(DateTimeField.HasConstantValue)\n Assert.Equal(DateTimeField.ConstantValue, New DateTime(634315546432909307))\n Assert.Equal(ConstantValueTypeDiscriminator.DateTime, DateTimeField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(New DateTime(634315546432909307), DateTimeField.GetConstantValue(ConstantFieldsInProgress.Empty).DateTimeValue)\n\n Assert.True(SingleField.IsConst)\n Assert.True(SingleField.HasConstantValue)\n Assert.Equal(SingleField.ConstantValue, 9.0F)\n Assert.Equal(ConstantValueTypeDiscriminator.Single, SingleField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(9.0F, SingleField.GetConstantValue(ConstantFieldsInProgress.Empty).SingleValue)\n\n Assert.True(DoubleField.IsConst)\n Assert.True(DoubleField.HasConstantValue)\n Assert.Equal(DoubleField.ConstantValue, -10.0)\n Assert.Equal(ConstantValueTypeDiscriminator.Double, DoubleField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(-10.0, DoubleField.GetConstantValue(ConstantFieldsInProgress.Empty).DoubleValue)\n\n Assert.True(StringField.IsConst)\n Assert.True(StringField.HasConstantValue)\n Assert.Equal(StringField.ConstantValue, \"11\")\n Assert.Equal(ConstantValueTypeDiscriminator.String, StringField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(\"11\", StringField.GetConstantValue(ConstantFieldsInProgress.Empty).StringValue)\n\n Assert.True(StringNullField.IsConst)\n Assert.True(StringNullField.HasConstantValue)\n Assert.Null(StringNullField.ConstantValue)\n Assert.Equal(ConstantValueTypeDiscriminator.Nothing, StringNullField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n\n Assert.True(ObjectNullField.IsConst)\n Assert.True(ObjectNullField.HasConstantValue)\n Assert.Null(ObjectNullField.ConstantValue)\n Assert.Equal(ConstantValueTypeDiscriminator.Nothing, ObjectNullField.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n\n\n 'ByteValue = 1\n 'SByteValue = -2\n 'UInt16Value = 3\n 'Int16Value = -4\n 'UInt32Value = 5\n 'Int32Value = -6\n 'UInt64Value = 7\n 'Int64Value = -8\n\n Dim ByteValue = DirectCast(ByteEnum.GetMembers(\"ByteValue\").Single(), FieldSymbol)\n Dim SByteValue = DirectCast(SByteEnum.GetMembers(\"SByteValue\").Single(), FieldSymbol)\n Dim UInt16Value = DirectCast(UInt16Enum.GetMembers(\"UInt16Value\").Single(), FieldSymbol)\n Dim Int16Value = DirectCast(Int16Enum.GetMembers(\"Int16Value\").Single(), FieldSymbol)\n Dim UInt32Value = DirectCast(UInt32Enum.GetMembers(\"UInt32Value\").Single(), FieldSymbol)\n Dim Int32Value = DirectCast(Int32Enum.GetMembers(\"Int32Value\").Single(), FieldSymbol)\n Dim UInt64Value = DirectCast(UInt64Enum.GetMembers(\"UInt64Value\").Single(), FieldSymbol)\n Dim Int64Value = DirectCast(Int64Enum.GetMembers(\"Int64Value\").Single(), FieldSymbol)\n\n Assert.True(ByteValue.IsConst)\n Assert.True(ByteValue.HasConstantValue)\n Assert.Equal(ByteValue.ConstantValue, CByte(1))\n Assert.Equal(ConstantValueTypeDiscriminator.Byte, ByteValue.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(CByte(1), ByteValue.GetConstantValue(ConstantFieldsInProgress.Empty).ByteValue)\n\n Assert.True(SByteValue.IsConst)\n Assert.True(SByteValue.HasConstantValue)\n Assert.Equal(SByteValue.ConstantValue, CSByte(-2))\n Assert.Equal(ConstantValueTypeDiscriminator.SByte, SByteValue.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(CSByte(-2), SByteValue.GetConstantValue(ConstantFieldsInProgress.Empty).SByteValue)\n\n Assert.True(UInt16Value.IsConst)\n Assert.True(UInt16Value.HasConstantValue)\n Assert.Equal(UInt16Value.ConstantValue, 3US)\n Assert.Equal(ConstantValueTypeDiscriminator.UInt16, UInt16Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(3US, UInt16Value.GetConstantValue(ConstantFieldsInProgress.Empty).UInt16Value)\n\n Assert.True(Int16Value.IsConst)\n Assert.True(Int16Value.HasConstantValue)\n Assert.Equal(Int16Value.ConstantValue, -4S)\n Assert.Equal(ConstantValueTypeDiscriminator.Int16, Int16Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(-4S, Int16Value.GetConstantValue(ConstantFieldsInProgress.Empty).Int16Value)\n\n Assert.True(UInt32Value.IsConst)\n Assert.True(UInt32Value.HasConstantValue)\n Assert.Equal(UInt32Value.ConstantValue, 5UI)\n Assert.Equal(ConstantValueTypeDiscriminator.UInt32, UInt32Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(5UI, UInt32Value.GetConstantValue(ConstantFieldsInProgress.Empty).UInt32Value)\n\n Assert.True(Int32Value.IsConst)\n Assert.True(Int32Value.HasConstantValue)\n Assert.Equal(Int32Value.ConstantValue, -6)\n Assert.Equal(ConstantValueTypeDiscriminator.Int32, Int32Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(-6, Int32Value.GetConstantValue(ConstantFieldsInProgress.Empty).Int32Value)\n\n Assert.True(UInt64Value.IsConst)\n Assert.True(UInt64Value.HasConstantValue)\n Assert.Equal(UInt64Value.ConstantValue, 7UL)\n Assert.Equal(ConstantValueTypeDiscriminator.UInt64, UInt64Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(7UL, UInt64Value.GetConstantValue(ConstantFieldsInProgress.Empty).UInt64Value)\n\n Assert.True(Int64Value.IsConst)\n Assert.True(Int64Value.HasConstantValue)\n Assert.Equal(Int64Value.ConstantValue, -8L)\n Assert.Equal(ConstantValueTypeDiscriminator.Int64, Int64Value.GetConstantValue(ConstantFieldsInProgress.Empty).Discriminator)\n Assert.Equal(-8L, Int64Value.GetConstantValue(ConstantFieldsInProgress.Empty).Int64Value)\n End Sub\n\n \n \n Public Sub EnumWithPrivateValueField()\n\n Dim ilSource = \"\n.class public auto ansi sealed TestEnum\n extends [mscorlib]System.Enum\n{\n .field private specialname rtspecialname int32 value__\n .field public static literal valuetype TestEnum Value1 = int32(0x00000000)\n .field public static literal valuetype TestEnum Value2 = int32(0x00000001)\n} // end of class TestEnum\n\"\n\n Dim vbSource =\n\n \nModule Module1\n Sub Main()\n Dim val as TestEnum = TestEnum.Value1\n System.Console.WriteLine(val.ToString())\n val = TestEnum.Value2\n System.Console.WriteLine(val.ToString())\n End Sub\nEnd Module\n \n\n\n Dim compilation = CreateCompilationWithCustomILSource(vbSource, ilSource, includeVbRuntime:=True, options:=TestOptions.DebugExe)\n\n CompileAndVerify(compilation, expectedOutput:=\"Value1\nValue2\")\n End Sub\n\n End Class\n\nEnd Namespace\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":831,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56424,"string":"56,424"},"pr_title":{"kind":"string","value":"EnC/HR interface unification"},"pr_description":{"kind":"string","value":"Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"author":{"kind":"string","value":"tmat"},"date_created":{"kind":"timestamp","value":"2021-09-15T22:22:11Z","string":"2021-09-15T22:22:11Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T16:03:37Z","string":"2021-09-21T16:03:37Z"},"previous_commit":{"kind":"string","value":"8574e338076f0a2d7a4bc0d129f00e7440e47fbb"},"pr_commit":{"kind":"string","value":"240a47028f8518833271b026667f18f2c02fcbd8"},"query":{"kind":"string","value":"EnC/HR interface unification. Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Portable/Errors/LazyUnmanagedCallersOnlyMethodCalledDiagnosticInfo.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Diagnostics;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.CSharp.Symbols;\n\nnamespace Microsoft.CodeAnalysis.CSharp\n{\n internal sealed class LazyUnmanagedCallersOnlyMethodCalledDiagnosticInfo : DiagnosticInfo\n {\n private DiagnosticInfo? _lazyActualUnmanagedCallersOnlyDiagnostic;\n\n private readonly MethodSymbol _method;\n private readonly bool _isDelegateConversion;\n\n internal LazyUnmanagedCallersOnlyMethodCalledDiagnosticInfo(MethodSymbol method, bool isDelegateConversion)\n : base(CSharp.MessageProvider.Instance, (int)ErrorCode.Unknown)\n {\n _method = method;\n _lazyActualUnmanagedCallersOnlyDiagnostic = null;\n _isDelegateConversion = isDelegateConversion;\n }\n\n internal override DiagnosticInfo GetResolvedInfo()\n {\n if (_lazyActualUnmanagedCallersOnlyDiagnostic is null)\n {\n UnmanagedCallersOnlyAttributeData? unmanagedCallersOnlyAttributeData = _method.GetUnmanagedCallersOnlyAttributeData(forceComplete: true);\n Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyAttributeData, UnmanagedCallersOnlyAttributeData.Uninitialized));\n Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyAttributeData, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound));\n\n var info = unmanagedCallersOnlyAttributeData is null\n ? CSDiagnosticInfo.VoidDiagnosticInfo\n : new CSDiagnosticInfo(_isDelegateConversion\n ? ErrorCode.ERR_UnmanagedCallersOnlyMethodsCannotBeConvertedToDelegate\n : ErrorCode.ERR_UnmanagedCallersOnlyMethodsCannotBeCalledDirectly,\n _method);\n\n Interlocked.CompareExchange(ref _lazyActualUnmanagedCallersOnlyDiagnostic, info, null);\n }\n\n return _lazyActualUnmanagedCallersOnlyDiagnostic;\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Diagnostics;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.CSharp.Symbols;\n\nnamespace Microsoft.CodeAnalysis.CSharp\n{\n internal sealed class LazyUnmanagedCallersOnlyMethodCalledDiagnosticInfo : DiagnosticInfo\n {\n private DiagnosticInfo? _lazyActualUnmanagedCallersOnlyDiagnostic;\n\n private readonly MethodSymbol _method;\n private readonly bool _isDelegateConversion;\n\n internal LazyUnmanagedCallersOnlyMethodCalledDiagnosticInfo(MethodSymbol method, bool isDelegateConversion)\n : base(CSharp.MessageProvider.Instance, (int)ErrorCode.Unknown)\n {\n _method = method;\n _lazyActualUnmanagedCallersOnlyDiagnostic = null;\n _isDelegateConversion = isDelegateConversion;\n }\n\n internal override DiagnosticInfo GetResolvedInfo()\n {\n if (_lazyActualUnmanagedCallersOnlyDiagnostic is null)\n {\n UnmanagedCallersOnlyAttributeData? unmanagedCallersOnlyAttributeData = _method.GetUnmanagedCallersOnlyAttributeData(forceComplete: true);\n Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyAttributeData, UnmanagedCallersOnlyAttributeData.Uninitialized));\n Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyAttributeData, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound));\n\n var info = unmanagedCallersOnlyAttributeData is null\n ? CSDiagnosticInfo.VoidDiagnosticInfo\n : new CSDiagnosticInfo(_isDelegateConversion\n ? ErrorCode.ERR_UnmanagedCallersOnlyMethodsCannotBeConvertedToDelegate\n : ErrorCode.ERR_UnmanagedCallersOnlyMethodsCannotBeCalledDirectly,\n _method);\n\n Interlocked.CompareExchange(ref _lazyActualUnmanagedCallersOnlyDiagnostic, info, null);\n }\n\n return _lazyActualUnmanagedCallersOnlyDiagnostic;\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":832,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56424,"string":"56,424"},"pr_title":{"kind":"string","value":"EnC/HR interface unification"},"pr_description":{"kind":"string","value":"Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"author":{"kind":"string","value":"tmat"},"date_created":{"kind":"timestamp","value":"2021-09-15T22:22:11Z","string":"2021-09-15T22:22:11Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T16:03:37Z","string":"2021-09-21T16:03:37Z"},"previous_commit":{"kind":"string","value":"8574e338076f0a2d7a4bc0d129f00e7440e47fbb"},"pr_commit":{"kind":"string","value":"240a47028f8518833271b026667f18f2c02fcbd8"},"query":{"kind":"string","value":"EnC/HR interface unification. Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"filepath":{"kind":"string","value":"./src/EditorFeatures/VisualBasicTest/Diagnostics/AddExplicitCast/AddExplicitCastTests_FixAllTests.vb"},"before_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nNamespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.AddExplicitCast\n Partial Public Class AddExplicitCastTests\n\n \n Public Async Function TestFixAllInDocumentBC30512() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n\n \n Public Async Function TestFixAllInProjectBC30512() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n\n \n Public Async Function TestFixAllInSolutionBC30512() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n\n \n Public Async Function TestFixAllInDocumentBC30519() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n\n \n Public Async Function TestFixAllInProjectBC30519() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n\n \n Public Async Function TestFixAllInSolutionBC30519() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n End Class\nEnd Namespace\n"},"after_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nNamespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.AddExplicitCast\n Partial Public Class AddExplicitCastTests\n\n \n Public Async Function TestFixAllInDocumentBC30512() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n\n \n Public Async Function TestFixAllInProjectBC30512() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n\n \n Public Async Function TestFixAllInSolutionBC30512() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n\n \n Public Async Function TestFixAllInDocumentBC30519() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n\n \n Public Async Function TestFixAllInProjectBC30519() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n\n \n Public Async Function TestFixAllInSolutionBC30519() As Task\n Dim input = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Dim expected = \n \n \n \n \n \n \n \n Assembly1\n \n \n \n .ToString()\n\n Await TestInRegularAndScriptAsync(input, expected)\n End Function\n End Class\nEnd Namespace\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":833,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56424,"string":"56,424"},"pr_title":{"kind":"string","value":"EnC/HR interface unification"},"pr_description":{"kind":"string","value":"Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"author":{"kind":"string","value":"tmat"},"date_created":{"kind":"timestamp","value":"2021-09-15T22:22:11Z","string":"2021-09-15T22:22:11Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T16:03:37Z","string":"2021-09-21T16:03:37Z"},"previous_commit":{"kind":"string","value":"8574e338076f0a2d7a4bc0d129f00e7440e47fbb"},"pr_commit":{"kind":"string","value":"240a47028f8518833271b026667f18f2c02fcbd8"},"query":{"kind":"string","value":"EnC/HR interface unification. Prepares for unification of EnC and Hot Reload debugger interfaces. In this PR we still implement two separate MEF components that delegate to a common implementation. These will be eliminated in vs-deps follow up.\r\n\r\nContributes to\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1363800\r\nhttps://devdiv.visualstudio.com/DevDiv/_workitems/edit/1371922\r\n\r\nFixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1407091\r\nFixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_queries/edit/1398619"},"filepath":{"kind":"string","value":"./src/Compilers/VisualBasic/Portable/Compilation/QuerySymbolInfo.vb"},"before_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Threading\nImports Microsoft.CodeAnalysis.VisualBasic.Syntax\n\nNamespace Microsoft.CodeAnalysis.VisualBasic\n\n Public Structure CollectionRangeVariableSymbolInfo\n ''' \n ''' Optional AsQueryable/AsEnumerable/Cast(Of Object) method used \n ''' to \"convert\" to queryable\n ''' collection.\n ''' \n Public ReadOnly Property ToQueryableCollectionConversion As SymbolInfo\n\n ''' \n ''' Optional Select method to handle AsClause.\n ''' \n Public ReadOnly Property AsClauseConversion As SymbolInfo\n\n ''' \n ''' SelectMany method for , which is not the first\n ''' in a , and is not the first \n ''' in .\n ''' \n Public ReadOnly Property SelectMany As SymbolInfo\n\n Friend Shared ReadOnly None As New CollectionRangeVariableSymbolInfo(SymbolInfo.None, SymbolInfo.None, SymbolInfo.None)\n\n Friend Sub New(\n toQueryableCollectionConversion As SymbolInfo,\n asClauseConversion As SymbolInfo,\n selectMany As SymbolInfo\n )\n Me.ToQueryableCollectionConversion = toQueryableCollectionConversion\n Me.AsClauseConversion = asClauseConversion\n Me.SelectMany = selectMany\n End Sub\n End Structure\n\n Public Structure AggregateClauseSymbolInfo\n ''' \n ''' The first of the two optional Select methods associated with .\n ''' \n Public ReadOnly Property Select1 As SymbolInfo\n\n ''' \n ''' The second of the two optional Select methods associated with .\n ''' \n Public ReadOnly Property Select2 As SymbolInfo\n\n Friend Sub New(select1 As SymbolInfo)\n Me.Select1 = select1\n Me.Select2 = SymbolInfo.None\n End Sub\n\n Friend Sub New(select1 As SymbolInfo, select2 As SymbolInfo)\n Me.Select1 = select1\n Me.Select2 = select2\n End Sub\n End Structure\n\n Partial Friend Class VBSemanticModel\n\n ''' \n ''' Returns information about methods associated with CollectionRangeVariableSyntax.\n ''' \n Public Function GetCollectionRangeVariableSymbolInfo(\n variableSyntax As CollectionRangeVariableSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As CollectionRangeVariableSymbolInfo\n If variableSyntax Is Nothing Then\n Throw New ArgumentNullException(NameOf(variableSyntax))\n End If\n If Not IsInTree(variableSyntax) Then\n Throw New ArgumentException(VBResources.VariableSyntaxNotWithinSyntaxTree)\n End If\n\n Return GetCollectionRangeVariableSymbolInfoWorker(variableSyntax, cancellationToken)\n End Function\n\n Friend MustOverride Function GetCollectionRangeVariableSymbolInfoWorker(node As CollectionRangeVariableSyntax, Optional cancellationToken As CancellationToken = Nothing) As CollectionRangeVariableSymbolInfo\n\n ''' \n ''' Returns information about methods associated with AggregateClauseSyntax.\n ''' \n Public Function GetAggregateClauseSymbolInfo(\n aggregateSyntax As AggregateClauseSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As AggregateClauseSymbolInfo\n If aggregateSyntax Is Nothing Then\n Throw New ArgumentNullException(NameOf(aggregateSyntax))\n End If\n If Not IsInTree(aggregateSyntax) Then\n Throw New ArgumentException(VBResources.AggregateSyntaxNotWithinSyntaxTree)\n End If\n\n ' Stand-alone Aggregate does not use Select methods.\n If aggregateSyntax.Parent Is Nothing OrElse\n (aggregateSyntax.Parent.Kind = SyntaxKind.QueryExpression AndAlso\n DirectCast(aggregateSyntax.Parent, QueryExpressionSyntax).Clauses.FirstOrDefault Is aggregateSyntax) Then\n Return New AggregateClauseSymbolInfo(SymbolInfo.None)\n End If\n\n Return GetAggregateClauseSymbolInfoWorker(aggregateSyntax, cancellationToken)\n End Function\n\n Friend MustOverride Function GetAggregateClauseSymbolInfoWorker(node As AggregateClauseSyntax, Optional cancellationToken As CancellationToken = Nothing) As AggregateClauseSymbolInfo\n\n ''' \n ''' DistinctClauseSyntax - Returns Distinct method associated with DistinctClauseSyntax.\n ''' \n ''' WhereClauseSyntax - Returns Where method associated with WhereClauseSyntax.\n ''' \n ''' PartitionWhileClauseSyntax - Returns TakeWhile/SkipWhile method associated with PartitionWhileClauseSyntax.\n ''' \n ''' PartitionClauseSyntax - Returns Take/Skip method associated with PartitionClauseSyntax.\n ''' \n ''' GroupByClauseSyntax - Returns GroupBy method associated with GroupByClauseSyntax.\n ''' \n ''' JoinClauseSyntax - Returns Join/GroupJoin method associated with JoinClauseSyntax/GroupJoinClauseSyntax.\n ''' \n ''' SelectClauseSyntax - Returns Select method associated with SelectClauseSyntax, if needed.\n ''' \n ''' FromClauseSyntax - Returns Select method associated with FromClauseSyntax, which has only one \n ''' CollectionRangeVariableSyntax and is the only query clause within \n ''' QueryExpressionSyntax. NotNeeded SymbolInfo otherwise. \n ''' The method call is injected by the compiler to make sure that query is translated to at \n ''' least one method call. \n ''' \n ''' LetClauseSyntax - NotNeeded SymbolInfo.\n ''' \n ''' OrderByClauseSyntax - NotNeeded SymbolInfo.\n ''' \n ''' AggregateClauseSyntax - Empty SymbolInfo. GetAggregateClauseInfo should be used instead.\n ''' \n Public Shadows Function GetSymbolInfo(\n clauseSyntax As QueryClauseSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As SymbolInfo\n CheckSyntaxNode(clauseSyntax)\n\n If CanGetSemanticInfo(clauseSyntax) Then\n Select Case clauseSyntax.Kind\n Case SyntaxKind.LetClause, SyntaxKind.OrderByClause\n Return SymbolInfo.None\n\n Case SyntaxKind.AggregateClause\n Return SymbolInfo.None\n End Select\n\n Return GetQueryClauseSymbolInfo(clauseSyntax, cancellationToken)\n Else\n Return SymbolInfo.None\n End If\n End Function\n\n Friend MustOverride Function GetQueryClauseSymbolInfo(node As QueryClauseSyntax, Optional cancellationToken As CancellationToken = Nothing) As SymbolInfo\n\n ''' \n ''' Returns Select method associated with ExpressionRangeVariableSyntax within a LetClauseSyntax, if needed.\n ''' NotNeeded SymbolInfo otherwise.\n ''' \n Public Shadows Function GetSymbolInfo(\n variableSyntax As ExpressionRangeVariableSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As SymbolInfo\n CheckSyntaxNode(variableSyntax)\n\n If CanGetSemanticInfo(variableSyntax) Then\n If variableSyntax.Parent Is Nothing OrElse variableSyntax.Parent.Kind <> SyntaxKind.LetClause Then\n Return SymbolInfo.None\n End If\n\n Return GetLetClauseSymbolInfo(variableSyntax, cancellationToken)\n Else\n Return SymbolInfo.None\n End If\n End Function\n\n Friend MustOverride Function GetLetClauseSymbolInfo(node As ExpressionRangeVariableSyntax, Optional cancellationToken As CancellationToken = Nothing) As SymbolInfo\n\n ''' \n ''' Returns aggregate function associated with FunctionAggregationSyntax.\n ''' \n Public Shadows Function GetSymbolInfo(\n functionSyntax As FunctionAggregationSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As SymbolInfo\n CheckSyntaxNode(functionSyntax)\n\n If CanGetSemanticInfo(functionSyntax) Then\n If Not IsInTree(functionSyntax) Then\n Throw New ArgumentException(VBResources.FunctionSyntaxNotWithinSyntaxTree)\n End If\n\n Return GetSymbolInfo(DirectCast(functionSyntax, ExpressionSyntax), cancellationToken)\n Else\n Return SymbolInfo.None\n End If\n End Function\n\n ''' \n ''' Returns OrderBy/OrderByDescending/ThenBy/ThenByDescending method associated with OrderingSyntax.\n ''' \n Public Shadows Function GetSymbolInfo(\n orderingSyntax As OrderingSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As SymbolInfo\n CheckSyntaxNode(orderingSyntax)\n\n If CanGetSemanticInfo(orderingSyntax) Then\n Return GetOrderingSymbolInfo(orderingSyntax, cancellationToken)\n Else\n Return SymbolInfo.None\n End If\n End Function\n\n Friend MustOverride Function GetOrderingSymbolInfo(node As OrderingSyntax, Optional cancellationToken As CancellationToken = Nothing) As SymbolInfo\n End Class\n\nEnd Namespace\n"},"after_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Threading\nImports Microsoft.CodeAnalysis.VisualBasic.Syntax\n\nNamespace Microsoft.CodeAnalysis.VisualBasic\n\n Public Structure CollectionRangeVariableSymbolInfo\n ''' \n ''' Optional AsQueryable/AsEnumerable/Cast(Of Object) method used \n ''' to \"convert\" to queryable\n ''' collection.\n ''' \n Public ReadOnly Property ToQueryableCollectionConversion As SymbolInfo\n\n ''' \n ''' Optional Select method to handle AsClause.\n ''' \n Public ReadOnly Property AsClauseConversion As SymbolInfo\n\n ''' \n ''' SelectMany method for , which is not the first\n ''' in a , and is not the first \n ''' in .\n ''' \n Public ReadOnly Property SelectMany As SymbolInfo\n\n Friend Shared ReadOnly None As New CollectionRangeVariableSymbolInfo(SymbolInfo.None, SymbolInfo.None, SymbolInfo.None)\n\n Friend Sub New(\n toQueryableCollectionConversion As SymbolInfo,\n asClauseConversion As SymbolInfo,\n selectMany As SymbolInfo\n )\n Me.ToQueryableCollectionConversion = toQueryableCollectionConversion\n Me.AsClauseConversion = asClauseConversion\n Me.SelectMany = selectMany\n End Sub\n End Structure\n\n Public Structure AggregateClauseSymbolInfo\n ''' \n ''' The first of the two optional Select methods associated with .\n ''' \n Public ReadOnly Property Select1 As SymbolInfo\n\n ''' \n ''' The second of the two optional Select methods associated with .\n ''' \n Public ReadOnly Property Select2 As SymbolInfo\n\n Friend Sub New(select1 As SymbolInfo)\n Me.Select1 = select1\n Me.Select2 = SymbolInfo.None\n End Sub\n\n Friend Sub New(select1 As SymbolInfo, select2 As SymbolInfo)\n Me.Select1 = select1\n Me.Select2 = select2\n End Sub\n End Structure\n\n Partial Friend Class VBSemanticModel\n\n ''' \n ''' Returns information about methods associated with CollectionRangeVariableSyntax.\n ''' \n Public Function GetCollectionRangeVariableSymbolInfo(\n variableSyntax As CollectionRangeVariableSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As CollectionRangeVariableSymbolInfo\n If variableSyntax Is Nothing Then\n Throw New ArgumentNullException(NameOf(variableSyntax))\n End If\n If Not IsInTree(variableSyntax) Then\n Throw New ArgumentException(VBResources.VariableSyntaxNotWithinSyntaxTree)\n End If\n\n Return GetCollectionRangeVariableSymbolInfoWorker(variableSyntax, cancellationToken)\n End Function\n\n Friend MustOverride Function GetCollectionRangeVariableSymbolInfoWorker(node As CollectionRangeVariableSyntax, Optional cancellationToken As CancellationToken = Nothing) As CollectionRangeVariableSymbolInfo\n\n ''' \n ''' Returns information about methods associated with AggregateClauseSyntax.\n ''' \n Public Function GetAggregateClauseSymbolInfo(\n aggregateSyntax As AggregateClauseSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As AggregateClauseSymbolInfo\n If aggregateSyntax Is Nothing Then\n Throw New ArgumentNullException(NameOf(aggregateSyntax))\n End If\n If Not IsInTree(aggregateSyntax) Then\n Throw New ArgumentException(VBResources.AggregateSyntaxNotWithinSyntaxTree)\n End If\n\n ' Stand-alone Aggregate does not use Select methods.\n If aggregateSyntax.Parent Is Nothing OrElse\n (aggregateSyntax.Parent.Kind = SyntaxKind.QueryExpression AndAlso\n DirectCast(aggregateSyntax.Parent, QueryExpressionSyntax).Clauses.FirstOrDefault Is aggregateSyntax) Then\n Return New AggregateClauseSymbolInfo(SymbolInfo.None)\n End If\n\n Return GetAggregateClauseSymbolInfoWorker(aggregateSyntax, cancellationToken)\n End Function\n\n Friend MustOverride Function GetAggregateClauseSymbolInfoWorker(node As AggregateClauseSyntax, Optional cancellationToken As CancellationToken = Nothing) As AggregateClauseSymbolInfo\n\n ''' \n ''' DistinctClauseSyntax - Returns Distinct method associated with DistinctClauseSyntax.\n ''' \n ''' WhereClauseSyntax - Returns Where method associated with WhereClauseSyntax.\n ''' \n ''' PartitionWhileClauseSyntax - Returns TakeWhile/SkipWhile method associated with PartitionWhileClauseSyntax.\n ''' \n ''' PartitionClauseSyntax - Returns Take/Skip method associated with PartitionClauseSyntax.\n ''' \n ''' GroupByClauseSyntax - Returns GroupBy method associated with GroupByClauseSyntax.\n ''' \n ''' JoinClauseSyntax - Returns Join/GroupJoin method associated with JoinClauseSyntax/GroupJoinClauseSyntax.\n ''' \n ''' SelectClauseSyntax - Returns Select method associated with SelectClauseSyntax, if needed.\n ''' \n ''' FromClauseSyntax - Returns Select method associated with FromClauseSyntax, which has only one \n ''' CollectionRangeVariableSyntax and is the only query clause within \n ''' QueryExpressionSyntax. NotNeeded SymbolInfo otherwise. \n ''' The method call is injected by the compiler to make sure that query is translated to at \n ''' least one method call. \n ''' \n ''' LetClauseSyntax - NotNeeded SymbolInfo.\n ''' \n ''' OrderByClauseSyntax - NotNeeded SymbolInfo.\n ''' \n ''' AggregateClauseSyntax - Empty SymbolInfo. GetAggregateClauseInfo should be used instead.\n ''' \n Public Shadows Function GetSymbolInfo(\n clauseSyntax As QueryClauseSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As SymbolInfo\n CheckSyntaxNode(clauseSyntax)\n\n If CanGetSemanticInfo(clauseSyntax) Then\n Select Case clauseSyntax.Kind\n Case SyntaxKind.LetClause, SyntaxKind.OrderByClause\n Return SymbolInfo.None\n\n Case SyntaxKind.AggregateClause\n Return SymbolInfo.None\n End Select\n\n Return GetQueryClauseSymbolInfo(clauseSyntax, cancellationToken)\n Else\n Return SymbolInfo.None\n End If\n End Function\n\n Friend MustOverride Function GetQueryClauseSymbolInfo(node As QueryClauseSyntax, Optional cancellationToken As CancellationToken = Nothing) As SymbolInfo\n\n ''' \n ''' Returns Select method associated with ExpressionRangeVariableSyntax within a LetClauseSyntax, if needed.\n ''' NotNeeded SymbolInfo otherwise.\n ''' \n Public Shadows Function GetSymbolInfo(\n variableSyntax As ExpressionRangeVariableSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As SymbolInfo\n CheckSyntaxNode(variableSyntax)\n\n If CanGetSemanticInfo(variableSyntax) Then\n If variableSyntax.Parent Is Nothing OrElse variableSyntax.Parent.Kind <> SyntaxKind.LetClause Then\n Return SymbolInfo.None\n End If\n\n Return GetLetClauseSymbolInfo(variableSyntax, cancellationToken)\n Else\n Return SymbolInfo.None\n End If\n End Function\n\n Friend MustOverride Function GetLetClauseSymbolInfo(node As ExpressionRangeVariableSyntax, Optional cancellationToken As CancellationToken = Nothing) As SymbolInfo\n\n ''' \n ''' Returns aggregate function associated with FunctionAggregationSyntax.\n ''' \n Public Shadows Function GetSymbolInfo(\n functionSyntax As FunctionAggregationSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As SymbolInfo\n CheckSyntaxNode(functionSyntax)\n\n If CanGetSemanticInfo(functionSyntax) Then\n If Not IsInTree(functionSyntax) Then\n Throw New ArgumentException(VBResources.FunctionSyntaxNotWithinSyntaxTree)\n End If\n\n Return GetSymbolInfo(DirectCast(functionSyntax, ExpressionSyntax), cancellationToken)\n Else\n Return SymbolInfo.None\n End If\n End Function\n\n ''' \n ''' Returns OrderBy/OrderByDescending/ThenBy/ThenByDescending method associated with OrderingSyntax.\n ''' \n Public Shadows Function GetSymbolInfo(\n orderingSyntax As OrderingSyntax,\n Optional cancellationToken As CancellationToken = Nothing\n ) As SymbolInfo\n CheckSyntaxNode(orderingSyntax)\n\n If CanGetSemanticInfo(orderingSyntax) Then\n Return GetOrderingSymbolInfo(orderingSyntax, cancellationToken)\n Else\n Return SymbolInfo.None\n End If\n End Function\n\n Friend MustOverride Function GetOrderingSymbolInfo(node As OrderingSyntax, Optional cancellationToken As CancellationToken = Nothing) As SymbolInfo\n End Class\n\nEnd Namespace\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":834,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56419,"string":"56,419"},"pr_title":{"kind":"string","value":"Fix partial method doc comments"},"pr_description":{"kind":"string","value":"Fixes #54103.\r\n\r\nThe specific rule changes implemented in this PR are laid out in dotnet/csharplang#5193.\r\n\r\nHave added tests to ensure that the expected documentation is shown in Quick Info."},"author":{"kind":"string","value":"RikkiGibson"},"date_created":{"kind":"timestamp","value":"2021-09-15T20:47:39Z","string":"2021-09-15T20:47:39Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T23:49:10Z","string":"2021-09-21T23:49:10Z"},"previous_commit":{"kind":"string","value":"0f60b3e9446f5d0fc14a570998c81a5d6c40cc23"},"pr_commit":{"kind":"string","value":"8cda7462843d43d9b72039eede2f4cb43126cac2"},"query":{"kind":"string","value":"Fix partial method doc comments. Fixes #54103.\r\n\r\nThe specific rule changes implemented in this PR are laid out in dotnet/csharplang#5193.\r\n\r\nHave added tests to ensure that the expected documentation is shown in Quick Info."},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Portable/Compiler/DocumentationCommentCompiler.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Reflection;\nusing System.Resources;\nusing System.Text;\nusing System.Threading;\nusing System.Xml;\nusing Microsoft.CodeAnalysis.Collections;\nusing Microsoft.CodeAnalysis.CSharp.Symbols;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp\n{\n /// \n /// Traverses the symbol table processing XML documentation comments and optionally writing them to\n /// a provided stream.\n /// \n internal partial class DocumentationCommentCompiler : CSharpSymbolVisitor\n {\n private readonly string _assemblyName;\n private readonly CSharpCompilation _compilation;\n private readonly TextWriter _writer; //never write directly - always use a helper\n private readonly SyntaxTree _filterTree; //if not null, limit analysis to types residing in this tree\n private readonly TextSpan? _filterSpanWithinTree; //if filterTree and filterSpanWithinTree is not null, limit analysis to types residing within this span in the filterTree.\n private readonly bool _processIncludes;\n private readonly bool _isForSingleSymbol; //minor differences in behavior between batch case and API case.\n private readonly BindingDiagnosticBag _diagnostics;\n private readonly CancellationToken _cancellationToken;\n\n private SyntaxNodeLocationComparer _lazyComparer;\n private DocumentationCommentIncludeCache _includedFileCache;\n\n private int _indentDepth;\n\n private Stack _temporaryStringBuilders;\n\n private DocumentationCommentCompiler(\n string assemblyName,\n CSharpCompilation compilation,\n TextWriter writer,\n SyntaxTree filterTree,\n TextSpan? filterSpanWithinTree,\n bool processIncludes,\n bool isForSingleSymbol,\n BindingDiagnosticBag diagnostics,\n CancellationToken cancellationToken)\n {\n _assemblyName = assemblyName;\n\n _compilation = compilation;\n _writer = writer;\n _filterTree = filterTree;\n _filterSpanWithinTree = filterSpanWithinTree;\n _processIncludes = processIncludes;\n _isForSingleSymbol = isForSingleSymbol;\n _diagnostics = diagnostics;\n _cancellationToken = cancellationToken;\n }\n\n /// \n /// Traverses the symbol table processing XML documentation comments and optionally writing them to\n /// a provided stream.\n /// \n /// Compilation that owns the symbol table.\n /// Assembly name override, if specified. Otherwise the of the source assembly is used.\n /// Stream to which XML will be written, if specified.\n /// Will be supplemented with documentation comment diagnostics.\n /// To stop traversing the symbol table early.\n /// Only report diagnostics from this syntax tree, if non-null.\n /// If and filterSpanWithinTree is non-null, report diagnostics within this span in the .\n#nullable enable\n public static void WriteDocumentationCommentXml(CSharpCompilation compilation, string? assemblyName, Stream? xmlDocStream, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken, SyntaxTree? filterTree = null, TextSpan? filterSpanWithinTree = null)\n#nullable disable\n {\n StreamWriter writer = null;\n if (xmlDocStream != null && xmlDocStream.CanWrite)\n {\n writer = new StreamWriter(\n stream: xmlDocStream,\n encoding: new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: false),\n bufferSize: 0x400, // Default.\n leaveOpen: true); // Don't close caller's stream.\n }\n\n try\n {\n using (writer)\n {\n var compiler = new DocumentationCommentCompiler(assemblyName ?? compilation.SourceAssembly.Name, compilation, writer, filterTree, filterSpanWithinTree,\n processIncludes: true, isForSingleSymbol: false, diagnostics: diagnostics, cancellationToken: cancellationToken);\n compiler.Visit(compilation.SourceAssembly.GlobalNamespace);\n Debug.Assert(compiler._indentDepth == 0);\n writer?.Flush();\n }\n }\n catch (Exception e)\n {\n diagnostics.Add(ErrorCode.ERR_DocFileGen, Location.None, e.Message);\n }\n\n if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag)\n {\n if (filterTree != null)\n {\n // Will respect the DocumentationMode.\n UnprocessedDocumentationCommentFinder.ReportUnprocessed(filterTree, filterSpanWithinTree, diagnosticBag, cancellationToken);\n }\n else\n {\n foreach (SyntaxTree tree in compilation.SyntaxTrees)\n {\n // Will respect the DocumentationMode.\n UnprocessedDocumentationCommentFinder.ReportUnprocessed(tree, null, diagnosticBag, cancellationToken);\n }\n }\n }\n }\n\n /// \n /// Gets the XML that would be written to the documentation comment file for this assembly.\n /// \n /// The symbol for which to retrieve documentation comments.\n /// True to treat includes as semantically meaningful (pull in contents from other files and bind crefs, etc).\n /// To stop traversing the symbol table early.\n internal static string GetDocumentationCommentXml(Symbol symbol, bool processIncludes, CancellationToken cancellationToken)\n {\n Debug.Assert(\n symbol.Kind == SymbolKind.Event ||\n symbol.Kind == SymbolKind.Field ||\n symbol.Kind == SymbolKind.Method ||\n symbol.Kind == SymbolKind.NamedType ||\n symbol.Kind == SymbolKind.Property);\n\n CSharpCompilation compilation = symbol.DeclaringCompilation;\n Debug.Assert(compilation != null);\n\n PooledStringBuilder pooled = PooledStringBuilder.GetInstance();\n StringWriter writer = new StringWriter(pooled.Builder);\n\n var compiler = new DocumentationCommentCompiler(\n assemblyName: null,\n compilation: compilation,\n writer: writer,\n filterTree: null,\n filterSpanWithinTree: null,\n processIncludes: processIncludes,\n isForSingleSymbol: true,\n diagnostics: BindingDiagnosticBag.Discarded,\n cancellationToken: cancellationToken);\n compiler.Visit(symbol);\n Debug.Assert(compiler._indentDepth == 0);\n\n writer.Dispose();\n return pooled.ToStringAndFree();\n }\n\n /// \n /// Write header, descend into members, and write footer.\n /// \n public override void VisitNamespace(NamespaceSymbol symbol)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n if (symbol.IsGlobalNamespace)\n {\n Debug.Assert(_assemblyName != null);\n\n WriteLine(\"\");\n WriteLine(\"\");\n Indent();\n\n if (!_compilation.Options.OutputKind.IsNetModule())\n {\n WriteLine(\"\");\n Indent();\n WriteLine(\"{0}\", _assemblyName);\n Unindent();\n WriteLine(\"\");\n }\n\n WriteLine(\"\");\n Indent();\n }\n\n Debug.Assert(!_isForSingleSymbol);\n foreach (var s in symbol.GetMembers())\n {\n _cancellationToken.ThrowIfCancellationRequested();\n s.Accept(this);\n }\n\n if (symbol.IsGlobalNamespace)\n {\n Unindent();\n WriteLine(\"\");\n Unindent();\n WriteLine(\"\");\n }\n }\n\n /// \n /// Write own documentation comments and then descend into members.\n /// \n public override void VisitNamedType(NamedTypeSymbol symbol)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n if (_filterTree != null && !symbol.IsDefinedInSourceTree(_filterTree, _filterSpanWithinTree))\n {\n return;\n }\n\n DefaultVisit(symbol);\n\n if (!_isForSingleSymbol)\n {\n foreach (Symbol member in symbol.GetMembers())\n {\n _cancellationToken.ThrowIfCancellationRequested();\n member.Accept(this);\n }\n }\n }\n\n /// \n /// Compile documentation comments on the symbol and write them to the stream if one is provided.\n /// \n public override void DefaultVisit(Symbol symbol)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n if (ShouldSkip(symbol))\n {\n return;\n }\n\n if (_filterTree != null && !symbol.IsDefinedInSourceTree(_filterTree, _filterSpanWithinTree))\n {\n return;\n }\n\n bool isPartialMethodDefinitionPart = symbol.IsPartialDefinition(); // CONSIDER: ignore this if isForSingleSymbol?\n if (isPartialMethodDefinitionPart)\n {\n MethodSymbol implementationPart = ((MethodSymbol)symbol).PartialImplementationPart;\n if ((object)implementationPart != null)\n {\n Visit(implementationPart);\n }\n }\n\n DocumentationMode maxDocumentationMode;\n ImmutableArray docCommentNodes;\n if (!TryGetDocumentationCommentNodes(symbol, out maxDocumentationMode, out docCommentNodes))\n {\n // If the XML in any of the doc comments is invalid, skip all further processing (for this symbol) and \n // just write a comment saying that info was lost for this symbol.\n string message = ErrorFacts.GetMessage(MessageID.IDS_XMLIGNORED, CultureInfo.CurrentUICulture);\n WriteLine(string.Format(CultureInfo.CurrentUICulture, message, symbol.GetDocumentationCommentId()));\n return;\n }\n\n // If there are no doc comments, then no further work is required (other than to report a diagnostic if one is required).\n if (docCommentNodes.IsEmpty)\n {\n if (maxDocumentationMode >= DocumentationMode.Diagnose && RequiresDocumentationComment(symbol))\n {\n // Report the error at a location in the tree that was parsing doc comments.\n Location location = GetLocationInTreeReportingDocumentationCommentDiagnostics(symbol);\n if (location != null)\n {\n _diagnostics.Add(ErrorCode.WRN_MissingXMLComment, location, symbol);\n }\n }\n return;\n }\n\n _cancellationToken.ThrowIfCancellationRequested();\n\n bool reportParameterOrTypeParameterDiagnostics = GetLocationInTreeReportingDocumentationCommentDiagnostics(symbol) != null;\n\n string withUnprocessedIncludes;\n bool haveParseError;\n HashSet documentedTypeParameters;\n HashSet documentedParameters;\n ImmutableArray includeElementNodes;\n if (!TryProcessDocumentationCommentTriviaNodes(\n symbol,\n isPartialMethodDefinitionPart,\n docCommentNodes,\n reportParameterOrTypeParameterDiagnostics,\n out withUnprocessedIncludes,\n out haveParseError,\n out documentedTypeParameters,\n out documentedParameters,\n out includeElementNodes))\n {\n return;\n }\n\n if (haveParseError)\n {\n // If the XML in any of the doc comments is invalid, skip all further processing (for this symbol) and \n // just write a comment saying that info was lost for this symbol.\n string message = ErrorFacts.GetMessage(MessageID.IDS_XMLIGNORED, CultureInfo.CurrentUICulture);\n WriteLine(string.Format(CultureInfo.CurrentUICulture, message, symbol.GetDocumentationCommentId()));\n return;\n }\n\n // If there are no include elements, then there's nothing to expand.\n if (!includeElementNodes.IsDefaultOrEmpty)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n // NOTE: we are expanding include elements AFTER formatting the comment, since the included text is pure\n // XML, not XML mixed with documentation comment trivia (e.g. ///). If we expanded them before formatting,\n // the formatting engine would have trouble determining what prefix to remove from each line.\n TextWriter expanderWriter = isPartialMethodDefinitionPart ? null : _writer; // Don't actually write partial method definition parts.\n IncludeElementExpander.ProcessIncludes(withUnprocessedIncludes, symbol, includeElementNodes,\n _compilation, ref documentedParameters, ref documentedTypeParameters, ref _includedFileCache, expanderWriter, _diagnostics, _cancellationToken);\n }\n else if (_writer != null && !isPartialMethodDefinitionPart)\n {\n // CONSIDER: The output would look a little different if we ran the XDocument through an XmlWriter. In particular, \n // formatting inside tags (e.g. <__tag___attr__=__\"value\"__>) would be normalized. Whitespace in elements would\n // (or should) not be affected. If we decide that this difference matters, we can run the XDocument through an XmlWriter.\n // Otherwise, just writing out the string saves a bunch of processing and does a better job of preserving whitespace.\n Write(withUnprocessedIncludes);\n }\n\n if (reportParameterOrTypeParameterDiagnostics)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n if (documentedParameters != null)\n {\n foreach (ParameterSymbol parameter in GetParameters(symbol))\n {\n if (!documentedParameters.Contains(parameter))\n {\n Location location = parameter.Locations[0];\n Debug.Assert(location.SourceTree.ReportDocumentationCommentDiagnostics()); //Should be the same tree as for the symbol.\n\n // NOTE: parameter name, since the parameter would be displayed as just its type.\n _diagnostics.Add(ErrorCode.WRN_MissingParamTag, location, parameter.Name, symbol);\n }\n }\n }\n\n if (documentedTypeParameters != null)\n {\n foreach (TypeParameterSymbol typeParameter in GetTypeParameters(symbol))\n {\n if (!documentedTypeParameters.Contains(typeParameter))\n {\n Location location = typeParameter.Locations[0];\n Debug.Assert(location.SourceTree.ReportDocumentationCommentDiagnostics()); //Should be the same tree as for the symbol.\n\n _diagnostics.Add(ErrorCode.WRN_MissingTypeParamTag, location, typeParameter, symbol);\n }\n }\n }\n }\n }\n\n private static bool ShouldSkip(Symbol symbol)\n {\n return symbol.IsImplicitlyDeclared ||\n symbol.IsAccessor() ||\n symbol is SynthesizedSimpleProgramEntryPointSymbol ||\n symbol is SynthesizedRecordPropertySymbol;\n }\n\n /// \n /// Loop over the DocumentationCommentTriviaSyntaxes. Gather\n /// 1) concatenated XML, as a string;\n /// 2) whether or not the XML is valid;\n /// 3) set of type parameters covered by <typeparam> elements;\n /// 4) set of parameters covered by <param> elements;\n /// 5) list of <include> elements, as SyntaxNodes.\n /// \n /// True, if at least one documentation comment was processed; false, otherwise.\n /// This was factored out for clarity, not because it's reusable.\n private bool TryProcessDocumentationCommentTriviaNodes(\n Symbol symbol,\n bool isPartialMethodDefinitionPart,\n ImmutableArray docCommentNodes,\n bool reportParameterOrTypeParameterDiagnostics,\n out string withUnprocessedIncludes,\n out bool haveParseError,\n out HashSet documentedTypeParameters,\n out HashSet documentedParameters,\n out ImmutableArray includeElementNodes)\n {\n Debug.Assert(!docCommentNodes.IsDefaultOrEmpty);\n\n bool processedDocComment = false; // Even if there are DocumentationCommentTriviaSyntax, we may not need to process any of them.\n\n ArrayBuilder includeElementNodesBuilder = null;\n\n documentedParameters = null;\n documentedTypeParameters = null;\n\n // Saw an XmlException while parsing one of the DocumentationCommentTriviaSyntax nodes.\n haveParseError = false;\n\n // We're doing substitution and formatting per-trivia, rather than per-symbol,\n // because a single symbol can have both single-line and multi-line style\n // doc comments.\n foreach (DocumentationCommentTriviaSyntax trivia in docCommentNodes)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n bool reportDiagnosticsForCurrentTrivia = trivia.SyntaxTree.ReportDocumentationCommentDiagnostics();\n\n if (!processedDocComment)\n {\n // Since we have to throw away all the parts if any part is bad, we need to write to an intermediate temp.\n BeginTemporaryString();\n\n if (_processIncludes)\n {\n includeElementNodesBuilder = ArrayBuilder.GetInstance();\n }\n\n // We DO want to write out partial method definition parts if we're processing includes\n // because we need to have XML to process.\n if (!isPartialMethodDefinitionPart || _processIncludes)\n {\n WriteLine(\"\", symbol.GetDocumentationCommentId());\n Indent();\n }\n\n processedDocComment = true;\n }\n\n // Will respect the DocumentationMode.\n string substitutedText = DocumentationCommentWalker.GetSubstitutedText(_compilation, _diagnostics, symbol, trivia,\n includeElementNodesBuilder, ref documentedParameters, ref documentedTypeParameters);\n\n string formattedXml = FormatComment(substitutedText);\n\n // It would be preferable to just parse the concatenated XML at the end of the loop (we wouldn't have\n // to wrap it in a root element and we wouldn't have to reparse in the IncludeElementExpander), but\n // then we wouldn't know whether or where to report a diagnostic.\n XmlException e = XmlDocumentationCommentTextReader.ParseAndGetException(formattedXml);\n if (e != null)\n {\n haveParseError = true;\n if (reportDiagnosticsForCurrentTrivia)\n {\n Location location = new SourceLocation(trivia.SyntaxTree, new TextSpan(trivia.SpanStart, 0));\n _diagnostics.Add(ErrorCode.WRN_XMLParseError, location, GetDescription(e));\n }\n }\n\n // For partial methods, all parts are validated, but only the implementation part is written to the XML stream.\n if (!isPartialMethodDefinitionPart || _processIncludes)\n {\n // This string already has indentation and line breaks, so don't call WriteLine - just write the text directly.\n Write(formattedXml);\n }\n }\n\n if (!processedDocComment)\n {\n withUnprocessedIncludes = null;\n includeElementNodes = default(ImmutableArray);\n\n return false;\n }\n\n if (!isPartialMethodDefinitionPart || _processIncludes)\n {\n Unindent();\n WriteLine(\"\");\n }\n\n // Free the temp.\n withUnprocessedIncludes = GetAndEndTemporaryString();\n\n // Free the builder, even if there was an error.\n includeElementNodes = _processIncludes ? includeElementNodesBuilder.ToImmutableAndFree() : default(ImmutableArray);\n\n return true;\n }\n\n private static Location GetLocationInTreeReportingDocumentationCommentDiagnostics(Symbol symbol)\n {\n foreach (Location location in symbol.Locations)\n {\n if (location.SourceTree.ReportDocumentationCommentDiagnostics())\n {\n return location;\n }\n }\n return null;\n }\n\n /// \n /// Similar to SymbolExtensions.GetParameters, but returns empty for unsupported symbols\n /// and handles delegates.\n /// \n private static ImmutableArray GetParameters(Symbol symbol)\n {\n switch (symbol.Kind)\n {\n case SymbolKind.NamedType:\n MethodSymbol delegateInvoke = ((NamedTypeSymbol)symbol).DelegateInvokeMethod;\n if ((object)delegateInvoke != null)\n {\n return delegateInvoke.Parameters;\n }\n break;\n case SymbolKind.Method:\n case SymbolKind.Property:\n case SymbolKind.Event:\n return symbol.GetParameters();\n }\n\n return ImmutableArray.Empty;\n }\n\n /// \n /// Similar to SymbolExtensions.GetMemberTypeParameters, but returns empty for unsupported symbols.\n /// \n private static ImmutableArray GetTypeParameters(Symbol symbol)\n {\n switch (symbol.Kind)\n {\n case SymbolKind.Method:\n case SymbolKind.NamedType:\n case SymbolKind.ErrorType:\n return symbol.GetMemberTypeParameters();\n }\n\n return ImmutableArray.Empty;\n }\n\n /// \n /// A symbol requires a documentation comment if it was explicitly declared and\n /// will be visible outside the current assembly (ignoring InternalsVisibleTo).\n /// Exception: accessors do not require doc comments.\n /// \n private static bool RequiresDocumentationComment(Symbol symbol)\n {\n Debug.Assert((object)symbol != null);\n\n if (ShouldSkip(symbol))\n {\n return false;\n }\n\n while ((object)symbol != null)\n {\n switch (symbol.DeclaredAccessibility)\n {\n case Accessibility.Public:\n case Accessibility.Protected:\n case Accessibility.ProtectedOrInternal:\n symbol = symbol.ContainingType;\n break;\n default:\n return false;\n }\n }\n\n return true;\n }\n\n /// \n /// Get all of the DocumentationCommentTriviaSyntax associated with any declaring syntax of the\n /// given symbol (except for partial methods, which only consider the part with the body).\n /// \n /// True if the nodes are all valid XML.\n private bool TryGetDocumentationCommentNodes(Symbol symbol, out DocumentationMode maxDocumentationMode, out ImmutableArray nodes)\n {\n maxDocumentationMode = DocumentationMode.None;\n nodes = default(ImmutableArray);\n\n ArrayBuilder builder = null;\n var diagnosticBag = _diagnostics.DiagnosticBag ?? DiagnosticBag.GetInstance();\n\n foreach (SyntaxReference reference in symbol.DeclaringSyntaxReferences)\n {\n DocumentationMode currDocumentationMode = reference.SyntaxTree.Options.DocumentationMode;\n maxDocumentationMode = currDocumentationMode > maxDocumentationMode ? currDocumentationMode : maxDocumentationMode;\n\n ImmutableArray triviaList = SourceDocumentationCommentUtils.GetDocumentationCommentTriviaFromSyntaxNode((CSharpSyntaxNode)reference.GetSyntax(), diagnosticBag);\n foreach (var trivia in triviaList)\n {\n if (ContainsXmlParseDiagnostic(trivia))\n {\n if (builder != null)\n {\n builder.Free();\n }\n return false;\n }\n\n if (builder == null)\n {\n builder = ArrayBuilder.GetInstance();\n }\n builder.Add(trivia);\n }\n }\n\n if (diagnosticBag != _diagnostics.DiagnosticBag)\n {\n diagnosticBag.Free();\n }\n\n if (builder == null)\n {\n nodes = ImmutableArray.Empty;\n }\n else\n {\n builder.Sort(Comparer);\n nodes = builder.ToImmutableAndFree();\n }\n\n return true;\n }\n\n private static bool ContainsXmlParseDiagnostic(DocumentationCommentTriviaSyntax node)\n {\n if (!node.ContainsDiagnostics)\n {\n return false;\n }\n\n foreach (Diagnostic diag in node.GetDiagnostics())\n {\n if ((ErrorCode)diag.Code == ErrorCode.WRN_XMLParseError)\n {\n return true;\n }\n }\n\n return false;\n }\n\n private static readonly string[] s_newLineSequences = new[] { \"\\r\\n\", \"\\r\", \"\\n\" };\n\n /// \n /// Given the full text of a documentation comment, strip off the comment punctuation (///, /**, etc)\n /// and add appropriate indentations.\n /// \n private string FormatComment(string substitutedText)\n {\n BeginTemporaryString();\n\n if (TrimmedStringStartsWith(substitutedText, \"///\"))\n {\n //Debug.Assert(lines.Take(numLines).All(line => TrimmedStringStartsWith(line, \"///\")));\n WriteFormattedSingleLineComment(substitutedText);\n }\n else\n {\n string[] lines = substitutedText.Split(s_newLineSequences, StringSplitOptions.None);\n\n int numLines = lines.Length;\n Debug.Assert(numLines > 0);\n\n if (string.IsNullOrEmpty(lines[numLines - 1]))\n {\n numLines--;\n Debug.Assert(numLines > 0);\n }\n\n Debug.Assert(TrimmedStringStartsWith(lines[0], \"/**\"));\n WriteFormattedMultiLineComment(lines, numLines);\n }\n\n return GetAndEndTemporaryString();\n }\n\n /// \n /// Given a string, find the index of the first non-whitespace char.\n /// \n /// The string to search\n /// The index of the first non-whitespace char in the string\n private static int GetIndexOfFirstNonWhitespaceChar(string str)\n {\n return GetIndexOfFirstNonWhitespaceChar(str, 0, str.Length);\n }\n\n /// \n /// Find the first non-whitespace character in a given substring.\n /// \n /// The string to search\n /// The start index\n /// The last index (non-inclusive)\n /// The index of the first non-whitespace char after index start in the string up to, but not including the end index\n private static int GetIndexOfFirstNonWhitespaceChar(string str, int start, int end)\n {\n Debug.Assert(start >= 0);\n Debug.Assert(start <= str.Length);\n Debug.Assert(end >= 0);\n Debug.Assert(end <= str.Length);\n Debug.Assert(end >= start);\n\n for (; start < end; start++)\n {\n if (!SyntaxFacts.IsWhitespace(str[start]))\n {\n break;\n }\n }\n\n return start;\n }\n\n /// \n /// Determine if the given string starts with the given prefix if whitespace\n /// is first trimmed from the beginning.\n /// \n /// The string to search\n /// The prefix\n /// true if str.TrimStart().StartsWith(prefix)\n private static bool TrimmedStringStartsWith(string str, string prefix)\n {\n // PERF: Avoid calling string.Trim() because that allocates a new substring\n int start = GetIndexOfFirstNonWhitespaceChar(str);\n int len = str.Length - start;\n if (len < prefix.Length)\n {\n return false;\n }\n\n for (int i = 0; i < prefix.Length; i++)\n {\n if (prefix[i] != str[i + start])\n {\n return false;\n }\n }\n\n return true;\n }\n\n /// \n /// Given a string which may contain newline sequences, get the index of the first newline\n /// sequence beginning at the given starting index.\n /// \n /// The string to split.\n /// The starting index within the string.\n /// The length of the newline sequence discovered. 0 if the end of the string was reached, otherwise either 1 or 2 chars\n /// The index of the start of the first newline sequence following the start index\n private static int IndexOfNewLine(string str, int start, out int newLineLength)\n {\n for (; start < str.Length; start++)\n {\n switch (str[start])\n {\n case '\\r':\n if ((start + 1) < str.Length && str[start + 1] == '\\n')\n {\n newLineLength = 2;\n }\n else\n {\n newLineLength = 1;\n }\n return start;\n\n case '\\n':\n newLineLength = 1;\n return start;\n }\n }\n\n newLineLength = 0;\n return start;\n }\n\n /// \n /// Given the full text of a single-line style documentation comment, for each line, strip off\n /// the comment punctuation (///) and add appropriate indentations.\n /// \n private void WriteFormattedSingleLineComment(string text)\n {\n // PERF: Avoid allocating intermediate strings e.g. via Split, Trim or Substring\n bool skipSpace = true;\n for (int start = 0; start < text.Length;)\n {\n int newLineLength;\n int end = IndexOfNewLine(text, start, out newLineLength);\n int trimStart = GetIndexOfFirstNonWhitespaceChar(text, start, end);\n int trimmedLength = end - trimStart;\n if (trimmedLength < 4 || !SyntaxFacts.IsWhitespace(text[trimStart + 3]))\n {\n skipSpace = false;\n break;\n }\n\n start = end + newLineLength;\n }\n\n int substringStart = skipSpace ? 4 : 3;\n\n for (int start = 0; start < text.Length;)\n {\n int newLineLength;\n int end = IndexOfNewLine(text, start, out newLineLength);\n int trimStart = GetIndexOfFirstNonWhitespaceChar(text, start, end) + substringStart;\n WriteSubStringLine(text, trimStart, end - trimStart);\n start = end + newLineLength;\n }\n }\n\n /// \n /// Given the full text of a multi-line style documentation comment, broken into lines, strip off\n /// the comment punctuation (/**, */, etc) and add appropriate indentations.\n /// \n private void WriteFormattedMultiLineComment(string[] lines, int numLines)\n {\n bool skipFirstLine = lines[0].Trim() == \"/**\";\n bool skipLastLine = lines[numLines - 1].Trim() == \"*/\";\n\n if (skipLastLine)\n {\n numLines--;\n Debug.Assert(numLines > 0);\n }\n\n int skipLength = 0;\n if (numLines > 1)\n {\n string pattern = FindMultiLineCommentPattern(lines[1]);\n\n if (pattern != null)\n {\n bool allMatch = true;\n\n for (int i = 2; i < numLines; i++)\n {\n string currentLinePattern = LongestCommonPrefix(pattern, lines[i]);\n if (string.IsNullOrWhiteSpace(currentLinePattern))\n {\n allMatch = false;\n break;\n }\n Debug.Assert(pattern.StartsWith(currentLinePattern, StringComparison.Ordinal));\n pattern = currentLinePattern;\n }\n\n if (allMatch)\n {\n skipLength = pattern.Length;\n }\n }\n }\n\n if (!skipFirstLine)\n {\n string trimmed = lines[0].TrimStart(null);\n if (!skipLastLine && numLines == 1)\n {\n trimmed = TrimEndOfMultiLineComment(trimmed);\n }\n WriteLine(trimmed.Substring(SyntaxFacts.IsWhitespace(trimmed[3]) ? 4 : 3));\n }\n\n for (int i = 1; i < numLines; i++)\n {\n string trimmed = lines[i].Substring(skipLength);\n\n // If we've already skipped the last line, this can't happen.\n if (!skipLastLine && i == numLines - 1)\n {\n trimmed = TrimEndOfMultiLineComment(trimmed);\n }\n\n WriteLine(trimmed);\n }\n }\n\n /// \n /// Remove \"*/\" and any following text, if it is present.\n /// \n private static string TrimEndOfMultiLineComment(string trimmed)\n {\n int index = trimmed.IndexOf(\"*/\", StringComparison.Ordinal);\n if (index >= 0)\n {\n trimmed = trimmed.Substring(0, index);\n }\n return trimmed;\n }\n\n /// \n /// Return the longest prefix matching [whitespace]*[*][whitespace]*.\n /// \n private static string FindMultiLineCommentPattern(string line)\n {\n int length = 0;\n\n bool seenStar = false;\n foreach (char ch in line)\n {\n if (SyntaxFacts.IsWhitespace(ch))\n {\n length++;\n }\n else if (!seenStar && ch == '*')\n {\n length++;\n seenStar = true;\n }\n else\n {\n break;\n }\n }\n\n return seenStar ? line.Substring(0, length) : null;\n }\n\n /// \n /// Return the longest common prefix of two strings\n /// \n private static string LongestCommonPrefix(string str1, string str2)\n {\n int pos = 0;\n int minLength = Math.Min(str1.Length, str2.Length);\n\n for (; pos < minLength && str1[pos] == str2[pos]; pos++)\n {\n }\n\n return str1.Substring(0, pos);\n }\n\n /// \n /// Bind a CrefSyntax and unwrap the result if it's an alias.\n /// \n /// \n /// Does not respect DocumentationMode, so use a temporary bag if diagnostics are not desired.\n /// \n private static string GetDocumentationCommentId(CrefSyntax crefSyntax, Binder binder, BindingDiagnosticBag diagnostics)\n {\n if (crefSyntax.ContainsDiagnostics)\n {\n return ToBadCrefString(crefSyntax);\n }\n\n Symbol ambiguityWinner;\n ImmutableArray symbols = binder.BindCref(crefSyntax, out ambiguityWinner, diagnostics);\n\n Symbol symbol;\n switch (symbols.Length)\n {\n case 0:\n return ToBadCrefString(crefSyntax);\n case 1:\n symbol = symbols[0];\n break;\n default:\n symbol = ambiguityWinner;\n Debug.Assert((object)symbol != null);\n break;\n }\n\n if (symbol.Kind == SymbolKind.Alias)\n {\n symbol = ((AliasSymbol)symbol).GetAliasTarget(basesBeingResolved: null);\n }\n\n if (symbol is NamespaceSymbol ns)\n {\n Debug.Assert(!ns.IsGlobalNamespace);\n diagnostics.AddAssembliesUsedByNamespaceReference(ns);\n }\n else\n {\n diagnostics.AddDependencies(symbol as TypeSymbol ?? symbol.ContainingType);\n }\n\n return symbol.OriginalDefinition.GetDocumentationCommentId();\n }\n\n /// \n /// Given a cref syntax that cannot be resolved, get the string that will be written to\n /// the documentation file in place of a documentation comment ID.\n /// \n private static string ToBadCrefString(CrefSyntax cref)\n {\n using (StringWriter tmp = new StringWriter(CultureInfo.InvariantCulture))\n {\n cref.WriteTo(tmp);\n return \"!:\" + tmp.ToString().Replace(\"{\", \"<\").Replace(\"}\", \">\");\n }\n }\n\n /// \n /// Bind an XmlNameAttributeSyntax and update the sets of documented parameters and type parameters.\n /// \n /// \n /// Does not respect DocumentationMode, so do not call unless diagnostics are desired.\n /// \n private static void BindName(\n XmlNameAttributeSyntax syntax,\n Binder binder,\n Symbol memberSymbol,\n ref HashSet documentedParameters,\n ref HashSet documentedTypeParameters,\n BindingDiagnosticBag diagnostics)\n {\n XmlNameAttributeElementKind elementKind = syntax.GetElementKind();\n\n // NOTE: We want the corresponding hash set to be non-null if we saw\n // any / elements, even if they didn't bind (for\n // WRN_MissingParamTag and WRN_MissingTypeParamTag).\n if (elementKind == XmlNameAttributeElementKind.Parameter)\n {\n if (documentedParameters == null)\n {\n documentedParameters = new HashSet();\n }\n }\n else if (elementKind == XmlNameAttributeElementKind.TypeParameter)\n {\n if (documentedTypeParameters == null)\n {\n documentedTypeParameters = new HashSet();\n }\n }\n\n IdentifierNameSyntax identifier = syntax.Identifier;\n\n if (identifier.ContainsDiagnostics)\n {\n return;\n }\n\n CompoundUseSiteInfo useSiteInfo = binder.GetNewCompoundUseSiteInfo(diagnostics);\n ImmutableArray referencedSymbols = binder.BindXmlNameAttribute(syntax, ref useSiteInfo);\n diagnostics.Add(syntax, useSiteInfo);\n\n if (referencedSymbols.IsEmpty)\n {\n switch (elementKind)\n {\n case XmlNameAttributeElementKind.Parameter:\n diagnostics.Add(ErrorCode.WRN_UnmatchedParamTag, identifier.Location, identifier);\n break;\n case XmlNameAttributeElementKind.ParameterReference:\n diagnostics.Add(ErrorCode.WRN_UnmatchedParamRefTag, identifier.Location, identifier, memberSymbol);\n break;\n case XmlNameAttributeElementKind.TypeParameter:\n diagnostics.Add(ErrorCode.WRN_UnmatchedTypeParamTag, identifier.Location, identifier);\n break;\n case XmlNameAttributeElementKind.TypeParameterReference:\n diagnostics.Add(ErrorCode.WRN_UnmatchedTypeParamRefTag, identifier.Location, identifier, memberSymbol);\n break;\n default:\n throw ExceptionUtilities.UnexpectedValue(elementKind);\n }\n }\n else\n {\n foreach (Symbol referencedSymbol in referencedSymbols)\n {\n if (elementKind == XmlNameAttributeElementKind.Parameter)\n {\n Debug.Assert(referencedSymbol.Kind == SymbolKind.Parameter);\n Debug.Assert(documentedParameters != null);\n\n // Restriction preserved from dev11: don't report this for the \"value\" parameter.\n // Here, we detect that case by checking the containing symbol - only \"value\"\n // parameters are contained by accessors, others are on the corresponding property/event.\n ParameterSymbol parameter = (ParameterSymbol)referencedSymbol;\n if (!parameter.ContainingSymbol.IsAccessor() && !documentedParameters.Add(parameter))\n {\n diagnostics.Add(ErrorCode.WRN_DuplicateParamTag, syntax.Location, identifier);\n }\n }\n else if (elementKind == XmlNameAttributeElementKind.TypeParameter)\n {\n Debug.Assert(referencedSymbol.Kind == SymbolKind.TypeParameter);\n Debug.Assert(documentedTypeParameters != null);\n\n if (!documentedTypeParameters.Add((TypeParameterSymbol)referencedSymbol))\n {\n diagnostics.Add(ErrorCode.WRN_DuplicateTypeParamTag, syntax.Location, identifier);\n }\n }\n }\n }\n }\n\n private IComparer Comparer\n {\n get\n {\n if (_lazyComparer == null)\n {\n _lazyComparer = new SyntaxNodeLocationComparer(_compilation);\n }\n return _lazyComparer;\n }\n }\n\n private void BeginTemporaryString()\n {\n if (_temporaryStringBuilders == null)\n {\n _temporaryStringBuilders = new Stack();\n }\n\n _temporaryStringBuilders.Push(new TemporaryStringBuilder(_indentDepth));\n }\n\n private string GetAndEndTemporaryString()\n {\n TemporaryStringBuilder t = _temporaryStringBuilders.Pop();\n Debug.Assert(_indentDepth == t.InitialIndentDepth, $\"Temporary strings should be indent-neutral (was {t.InitialIndentDepth}, is {_indentDepth})\");\n _indentDepth = t.InitialIndentDepth;\n return t.Pooled.ToStringAndFree();\n }\n\n private void Indent()\n {\n _indentDepth++;\n }\n\n private void Unindent()\n {\n _indentDepth--;\n Debug.Assert(_indentDepth >= 0);\n }\n\n private void Write(string indentedAndWrappedString)\n {\n if (_temporaryStringBuilders != null && _temporaryStringBuilders.Count > 0)\n {\n StringBuilder builder = _temporaryStringBuilders.Peek().Pooled.Builder;\n builder.Append(indentedAndWrappedString);\n }\n else if (_writer != null)\n {\n _writer.Write(indentedAndWrappedString);\n }\n }\n\n private void WriteLine(string message)\n {\n if (_temporaryStringBuilders?.Count > 0)\n {\n StringBuilder builder = _temporaryStringBuilders.Peek().Pooled.Builder;\n builder.Append(MakeIndent(_indentDepth));\n builder.AppendLine(message);\n }\n else if (_writer != null)\n {\n _writer.Write(MakeIndent(_indentDepth));\n _writer.WriteLine(message);\n }\n }\n\n private void WriteSubStringLine(string message, int start, int length)\n {\n if (_temporaryStringBuilders?.Count > 0)\n {\n StringBuilder builder = _temporaryStringBuilders.Peek().Pooled.Builder;\n builder.Append(MakeIndent(_indentDepth));\n builder.Append(message, start, length);\n builder.AppendLine();\n }\n else if (_writer != null)\n {\n _writer.Write(MakeIndent(_indentDepth));\n for (int i = 0; i < length; i++)\n {\n _writer.Write(message[start + i]);\n }\n _writer.WriteLine();\n }\n }\n\n private void WriteLine(string format, params object[] args)\n {\n WriteLine(string.Format(format, args));\n }\n\n private static string MakeIndent(int depth)\n {\n Debug.Assert(depth >= 0);\n\n // Since we know a lot about the structure of the output,\n // we should be able to do this without constructing any\n // new string objects.\n switch (depth)\n {\n case 0:\n return \"\";\n case 1:\n return \" \";\n case 2:\n return \" \";\n case 3:\n return \" \";\n default:\n Debug.Assert(false, \"Didn't expect nesting to reach depth \" + depth);\n return new string(' ', depth * 4);\n }\n }\n\n /// \n /// WORKAROUND:\n /// We're taking a dependency on the location and structure of a framework assembly resource. This is not a robust solution.\n /// \n /// Possible alternatives:\n /// 1) Polish our XML parser until it matches MSXML. We don't want to reinvent the wheel.\n /// 2) Build a map that lets us go from XML string positions back to source positions. \n /// This is what the native compiler did, and it was a lot of work. We'd also still need to modify the message.\n /// 3) Do not report a diagnostic. This is very unhelpful.\n /// 4) Report a vague diagnostic (i.e. there's a problem somewhere in this doc comment). This is relatively unhelpful.\n /// 5) Always report the message in English, so that we can pull it apart without needing to consume resource files.\n /// This engenders a lot of ill will.\n /// 6) Report the exception message without modification and (optionally) include the text with respect to which the\n /// position is specified. This would not look sufficiently polished.\n /// \n private static string GetDescription(XmlException e)\n {\n string message = e.Message;\n try\n {\n ResourceManager manager = new ResourceManager(\"System.Xml\", typeof(XmlException).GetTypeInfo().Assembly);\n string locationTemplate = manager.GetString(\"Xml_MessageWithErrorPosition\");\n string locationString = string.Format(locationTemplate, \"\", e.LineNumber, e.LinePosition); // first arg is where the problem description goes\n int position = message.IndexOf(locationString, StringComparison.Ordinal); // Expect exact match\n return position < 0\n ? message\n : message.Remove(position, locationString.Length);\n }\n catch\n {\n Debug.Assert(false, \"If we hit this, then we might need to think about a different workaround \" +\n \"for stripping the location out the message.\");\n\n // If anything at all goes wrong, just return the message verbatim. It probably\n // contains an invalid position, but it's better than nothing.\n return message;\n }\n }\n\n private struct TemporaryStringBuilder\n {\n public readonly PooledStringBuilder Pooled;\n public readonly int InitialIndentDepth;\n\n public TemporaryStringBuilder(int indentDepth)\n {\n this.InitialIndentDepth = indentDepth;\n this.Pooled = PooledStringBuilder.GetInstance();\n }\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Reflection;\nusing System.Resources;\nusing System.Text;\nusing System.Threading;\nusing System.Xml;\nusing Microsoft.CodeAnalysis.Collections;\nusing Microsoft.CodeAnalysis.CSharp.Symbols;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp\n{\n /// \n /// Traverses the symbol table processing XML documentation comments and optionally writing them to\n /// a provided stream.\n /// \n internal partial class DocumentationCommentCompiler : CSharpSymbolVisitor\n {\n private readonly string _assemblyName;\n private readonly CSharpCompilation _compilation;\n private readonly TextWriter _writer; //never write directly - always use a helper\n private readonly SyntaxTree _filterTree; //if not null, limit analysis to types residing in this tree\n private readonly TextSpan? _filterSpanWithinTree; //if filterTree and filterSpanWithinTree is not null, limit analysis to types residing within this span in the filterTree.\n private readonly bool _processIncludes;\n private readonly bool _isForSingleSymbol; //minor differences in behavior between batch case and API case.\n private readonly BindingDiagnosticBag _diagnostics;\n private readonly CancellationToken _cancellationToken;\n\n private SyntaxNodeLocationComparer _lazyComparer;\n private DocumentationCommentIncludeCache _includedFileCache;\n\n private int _indentDepth;\n\n private Stack _temporaryStringBuilders;\n\n private DocumentationCommentCompiler(\n string assemblyName,\n CSharpCompilation compilation,\n TextWriter writer,\n SyntaxTree filterTree,\n TextSpan? filterSpanWithinTree,\n bool processIncludes,\n bool isForSingleSymbol,\n BindingDiagnosticBag diagnostics,\n CancellationToken cancellationToken)\n {\n _assemblyName = assemblyName;\n\n _compilation = compilation;\n _writer = writer;\n _filterTree = filterTree;\n _filterSpanWithinTree = filterSpanWithinTree;\n _processIncludes = processIncludes;\n _isForSingleSymbol = isForSingleSymbol;\n _diagnostics = diagnostics;\n _cancellationToken = cancellationToken;\n }\n\n /// \n /// Traverses the symbol table processing XML documentation comments and optionally writing them to\n /// a provided stream.\n /// \n /// Compilation that owns the symbol table.\n /// Assembly name override, if specified. Otherwise the of the source assembly is used.\n /// Stream to which XML will be written, if specified.\n /// Will be supplemented with documentation comment diagnostics.\n /// To stop traversing the symbol table early.\n /// Only report diagnostics from this syntax tree, if non-null.\n /// If and filterSpanWithinTree is non-null, report diagnostics within this span in the .\n#nullable enable\n public static void WriteDocumentationCommentXml(CSharpCompilation compilation, string? assemblyName, Stream? xmlDocStream, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken, SyntaxTree? filterTree = null, TextSpan? filterSpanWithinTree = null)\n#nullable disable\n {\n StreamWriter writer = null;\n if (xmlDocStream != null && xmlDocStream.CanWrite)\n {\n writer = new StreamWriter(\n stream: xmlDocStream,\n encoding: new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: false),\n bufferSize: 0x400, // Default.\n leaveOpen: true); // Don't close caller's stream.\n }\n\n try\n {\n using (writer)\n {\n var compiler = new DocumentationCommentCompiler(assemblyName ?? compilation.SourceAssembly.Name, compilation, writer, filterTree, filterSpanWithinTree,\n processIncludes: true, isForSingleSymbol: false, diagnostics: diagnostics, cancellationToken: cancellationToken);\n compiler.Visit(compilation.SourceAssembly.GlobalNamespace);\n Debug.Assert(compiler._indentDepth == 0);\n writer?.Flush();\n }\n }\n catch (Exception e)\n {\n diagnostics.Add(ErrorCode.ERR_DocFileGen, Location.None, e.Message);\n }\n\n if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag)\n {\n if (filterTree != null)\n {\n // Will respect the DocumentationMode.\n UnprocessedDocumentationCommentFinder.ReportUnprocessed(filterTree, filterSpanWithinTree, diagnosticBag, cancellationToken);\n }\n else\n {\n foreach (SyntaxTree tree in compilation.SyntaxTrees)\n {\n // Will respect the DocumentationMode.\n UnprocessedDocumentationCommentFinder.ReportUnprocessed(tree, null, diagnosticBag, cancellationToken);\n }\n }\n }\n }\n\n /// \n /// Gets the XML that would be written to the documentation comment file for this assembly.\n /// \n /// The symbol for which to retrieve documentation comments.\n /// True to treat includes as semantically meaningful (pull in contents from other files and bind crefs, etc).\n /// To stop traversing the symbol table early.\n internal static string GetDocumentationCommentXml(Symbol symbol, bool processIncludes, CancellationToken cancellationToken)\n {\n Debug.Assert(\n symbol.Kind == SymbolKind.Event ||\n symbol.Kind == SymbolKind.Field ||\n symbol.Kind == SymbolKind.Method ||\n symbol.Kind == SymbolKind.NamedType ||\n symbol.Kind == SymbolKind.Property);\n\n CSharpCompilation compilation = symbol.DeclaringCompilation;\n Debug.Assert(compilation != null);\n\n PooledStringBuilder pooled = PooledStringBuilder.GetInstance();\n StringWriter writer = new StringWriter(pooled.Builder);\n\n var compiler = new DocumentationCommentCompiler(\n assemblyName: null,\n compilation: compilation,\n writer: writer,\n filterTree: null,\n filterSpanWithinTree: null,\n processIncludes: processIncludes,\n isForSingleSymbol: true,\n diagnostics: BindingDiagnosticBag.Discarded,\n cancellationToken: cancellationToken);\n compiler.Visit(symbol);\n Debug.Assert(compiler._indentDepth == 0);\n\n writer.Dispose();\n return pooled.ToStringAndFree();\n }\n\n /// \n /// Write header, descend into members, and write footer.\n /// \n public override void VisitNamespace(NamespaceSymbol symbol)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n if (symbol.IsGlobalNamespace)\n {\n Debug.Assert(_assemblyName != null);\n\n WriteLine(\"\");\n WriteLine(\"\");\n Indent();\n\n if (!_compilation.Options.OutputKind.IsNetModule())\n {\n WriteLine(\"\");\n Indent();\n WriteLine(\"{0}\", _assemblyName);\n Unindent();\n WriteLine(\"\");\n }\n\n WriteLine(\"\");\n Indent();\n }\n\n Debug.Assert(!_isForSingleSymbol);\n foreach (var s in symbol.GetMembers())\n {\n _cancellationToken.ThrowIfCancellationRequested();\n s.Accept(this);\n }\n\n if (symbol.IsGlobalNamespace)\n {\n Unindent();\n WriteLine(\"\");\n Unindent();\n WriteLine(\"\");\n }\n }\n\n /// \n /// Write own documentation comments and then descend into members.\n /// \n public override void VisitNamedType(NamedTypeSymbol symbol)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n if (_filterTree != null && !symbol.IsDefinedInSourceTree(_filterTree, _filterSpanWithinTree))\n {\n return;\n }\n\n DefaultVisit(symbol);\n\n if (!_isForSingleSymbol)\n {\n foreach (Symbol member in symbol.GetMembers())\n {\n _cancellationToken.ThrowIfCancellationRequested();\n member.Accept(this);\n }\n }\n }\n\n /// \n /// Compile documentation comments on the symbol and write them to the stream if one is provided.\n /// \n public override void DefaultVisit(Symbol symbol)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n if (ShouldSkip(symbol))\n {\n return;\n }\n\n if (_filterTree != null && !symbol.IsDefinedInSourceTree(_filterTree, _filterSpanWithinTree))\n {\n return;\n }\n\n bool shouldSkipPartialDefinitionComments = false;\n if (symbol.IsPartialDefinition())\n {\n if (symbol is MethodSymbol { PartialImplementationPart: MethodSymbol implementationPart })\n {\n Visit(implementationPart);\n\n foreach (var trivia in implementationPart.GetNonNullSyntaxNode().GetLeadingTrivia())\n {\n if (trivia.Kind() is SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia)\n {\n // If the partial method implementation has doc comments,\n // we will not emit any doc comments found on the definition,\n // regardless of whether the partial implementation doc comments are valid.\n shouldSkipPartialDefinitionComments = true;\n break;\n }\n }\n }\n else\n {\n // The partial method has no implementation. Since it won't be present in the\n // output assembly, it shouldn't be included in the documentation file.\n shouldSkipPartialDefinitionComments = !_isForSingleSymbol;\n }\n }\n\n DocumentationMode maxDocumentationMode;\n ImmutableArray docCommentNodes;\n if (!TryGetDocumentationCommentNodes(symbol, out maxDocumentationMode, out docCommentNodes))\n {\n // If the XML in any of the doc comments is invalid, skip all further processing (for this symbol) and \n // just write a comment saying that info was lost for this symbol.\n string message = ErrorFacts.GetMessage(MessageID.IDS_XMLIGNORED, CultureInfo.CurrentUICulture);\n WriteLine(string.Format(CultureInfo.CurrentUICulture, message, symbol.GetDocumentationCommentId()));\n return;\n }\n\n // If there are no doc comments, then no further work is required (other than to report a diagnostic if one is required).\n if (docCommentNodes.IsEmpty)\n {\n if (maxDocumentationMode >= DocumentationMode.Diagnose\n && RequiresDocumentationComment(symbol)\n // We never give a missing doc comment warning on a partial method\n // implementation, and we skip the missing doc comment warning on a partial\n // definition whose documentation we were not going to output anyway.\n && !symbol.IsPartialImplementation()\n && !shouldSkipPartialDefinitionComments)\n {\n // Report the error at a location in the tree that was parsing doc comments.\n Location location = GetLocationInTreeReportingDocumentationCommentDiagnostics(symbol);\n if (location != null)\n {\n _diagnostics.Add(ErrorCode.WRN_MissingXMLComment, location, symbol);\n }\n }\n return;\n }\n\n _cancellationToken.ThrowIfCancellationRequested();\n\n bool reportParameterOrTypeParameterDiagnostics = GetLocationInTreeReportingDocumentationCommentDiagnostics(symbol) != null;\n\n string withUnprocessedIncludes;\n bool haveParseError;\n HashSet documentedTypeParameters;\n HashSet documentedParameters;\n ImmutableArray includeElementNodes;\n if (!TryProcessDocumentationCommentTriviaNodes(\n symbol,\n shouldSkipPartialDefinitionComments,\n docCommentNodes,\n reportParameterOrTypeParameterDiagnostics,\n out withUnprocessedIncludes,\n out haveParseError,\n out documentedTypeParameters,\n out documentedParameters,\n out includeElementNodes))\n {\n return;\n }\n\n if (haveParseError)\n {\n // If the XML in any of the doc comments is invalid, skip all further processing (for this symbol) and \n // just write a comment saying that info was lost for this symbol.\n string message = ErrorFacts.GetMessage(MessageID.IDS_XMLIGNORED, CultureInfo.CurrentUICulture);\n WriteLine(string.Format(CultureInfo.CurrentUICulture, message, symbol.GetDocumentationCommentId()));\n return;\n }\n\n // If there are no include elements, then there's nothing to expand.\n if (!includeElementNodes.IsDefaultOrEmpty)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n // NOTE: we are expanding include elements AFTER formatting the comment, since the included text is pure\n // XML, not XML mixed with documentation comment trivia (e.g. ///). If we expanded them before formatting,\n // the formatting engine would have trouble determining what prefix to remove from each line.\n TextWriter expanderWriter = shouldSkipPartialDefinitionComments ? null : _writer; // Don't actually write partial method definition parts.\n IncludeElementExpander.ProcessIncludes(withUnprocessedIncludes, symbol, includeElementNodes,\n _compilation, ref documentedParameters, ref documentedTypeParameters, ref _includedFileCache, expanderWriter, _diagnostics, _cancellationToken);\n }\n else if (_writer != null && !shouldSkipPartialDefinitionComments)\n {\n // CONSIDER: The output would look a little different if we ran the XDocument through an XmlWriter. In particular, \n // formatting inside tags (e.g. <__tag___attr__=__\"value\"__>) would be normalized. Whitespace in elements would\n // (or should) not be affected. If we decide that this difference matters, we can run the XDocument through an XmlWriter.\n // Otherwise, just writing out the string saves a bunch of processing and does a better job of preserving whitespace.\n Write(withUnprocessedIncludes);\n }\n\n if (reportParameterOrTypeParameterDiagnostics)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n if (documentedParameters != null)\n {\n foreach (ParameterSymbol parameter in GetParameters(symbol))\n {\n if (!documentedParameters.Contains(parameter))\n {\n Location location = parameter.Locations[0];\n Debug.Assert(location.SourceTree.ReportDocumentationCommentDiagnostics()); //Should be the same tree as for the symbol.\n\n // NOTE: parameter name, since the parameter would be displayed as just its type.\n _diagnostics.Add(ErrorCode.WRN_MissingParamTag, location, parameter.Name, symbol);\n }\n }\n }\n\n if (documentedTypeParameters != null)\n {\n foreach (TypeParameterSymbol typeParameter in GetTypeParameters(symbol))\n {\n if (!documentedTypeParameters.Contains(typeParameter))\n {\n Location location = typeParameter.Locations[0];\n Debug.Assert(location.SourceTree.ReportDocumentationCommentDiagnostics()); //Should be the same tree as for the symbol.\n\n _diagnostics.Add(ErrorCode.WRN_MissingTypeParamTag, location, typeParameter, symbol);\n }\n }\n }\n }\n }\n\n private static bool ShouldSkip(Symbol symbol)\n {\n return symbol.IsImplicitlyDeclared ||\n symbol.IsAccessor() ||\n symbol is SynthesizedSimpleProgramEntryPointSymbol ||\n symbol is SynthesizedRecordPropertySymbol;\n }\n\n /// \n /// Loop over the DocumentationCommentTriviaSyntaxes. Gather\n /// 1) concatenated XML, as a string;\n /// 2) whether or not the XML is valid;\n /// 3) set of type parameters covered by <typeparam> elements;\n /// 4) set of parameters covered by <param> elements;\n /// 5) list of <include> elements, as SyntaxNodes.\n /// \n /// True, if at least one documentation comment was processed; false, otherwise.\n /// This was factored out for clarity, not because it's reusable.\n private bool TryProcessDocumentationCommentTriviaNodes(\n Symbol symbol,\n bool shouldSkipPartialDefinitionComments,\n ImmutableArray docCommentNodes,\n bool reportParameterOrTypeParameterDiagnostics,\n out string withUnprocessedIncludes,\n out bool haveParseError,\n out HashSet documentedTypeParameters,\n out HashSet documentedParameters,\n out ImmutableArray includeElementNodes)\n {\n Debug.Assert(!docCommentNodes.IsDefaultOrEmpty);\n\n bool processedDocComment = false; // Even if there are DocumentationCommentTriviaSyntax, we may not need to process any of them.\n\n ArrayBuilder includeElementNodesBuilder = null;\n\n documentedParameters = null;\n documentedTypeParameters = null;\n\n // Saw an XmlException while parsing one of the DocumentationCommentTriviaSyntax nodes.\n haveParseError = false;\n\n // We're doing substitution and formatting per-trivia, rather than per-symbol,\n // because a single symbol can have both single-line and multi-line style\n // doc comments.\n foreach (DocumentationCommentTriviaSyntax trivia in docCommentNodes)\n {\n _cancellationToken.ThrowIfCancellationRequested();\n\n bool reportDiagnosticsForCurrentTrivia = trivia.SyntaxTree.ReportDocumentationCommentDiagnostics();\n\n if (!processedDocComment)\n {\n // Since we have to throw away all the parts if any part is bad, we need to write to an intermediate temp.\n BeginTemporaryString();\n\n if (_processIncludes)\n {\n includeElementNodesBuilder = ArrayBuilder.GetInstance();\n }\n\n // We DO want to write out partial method definition parts if we're processing includes\n // because we need to have XML to process.\n if (!shouldSkipPartialDefinitionComments || _processIncludes)\n {\n WriteLine(\"\", symbol.GetDocumentationCommentId());\n Indent();\n }\n\n processedDocComment = true;\n }\n\n // Will respect the DocumentationMode.\n string substitutedText = DocumentationCommentWalker.GetSubstitutedText(_compilation, _diagnostics, symbol, trivia,\n includeElementNodesBuilder, ref documentedParameters, ref documentedTypeParameters);\n\n string formattedXml = FormatComment(substitutedText);\n\n // It would be preferable to just parse the concatenated XML at the end of the loop (we wouldn't have\n // to wrap it in a root element and we wouldn't have to reparse in the IncludeElementExpander), but\n // then we wouldn't know whether or where to report a diagnostic.\n XmlException e = XmlDocumentationCommentTextReader.ParseAndGetException(formattedXml);\n if (e != null)\n {\n haveParseError = true;\n if (reportDiagnosticsForCurrentTrivia)\n {\n Location location = new SourceLocation(trivia.SyntaxTree, new TextSpan(trivia.SpanStart, 0));\n _diagnostics.Add(ErrorCode.WRN_XMLParseError, location, GetDescription(e));\n }\n }\n\n // For partial methods, all parts are validated, but only the implementation part is written to the XML stream.\n if (!shouldSkipPartialDefinitionComments || _processIncludes)\n {\n // This string already has indentation and line breaks, so don't call WriteLine - just write the text directly.\n Write(formattedXml);\n }\n }\n\n if (!processedDocComment)\n {\n withUnprocessedIncludes = null;\n includeElementNodes = default(ImmutableArray);\n\n return false;\n }\n\n if (!shouldSkipPartialDefinitionComments || _processIncludes)\n {\n Unindent();\n WriteLine(\"\");\n }\n\n // Free the temp.\n withUnprocessedIncludes = GetAndEndTemporaryString();\n\n // Free the builder, even if there was an error.\n includeElementNodes = _processIncludes ? includeElementNodesBuilder.ToImmutableAndFree() : default(ImmutableArray);\n\n return true;\n }\n\n private static Location GetLocationInTreeReportingDocumentationCommentDiagnostics(Symbol symbol)\n {\n foreach (Location location in symbol.Locations)\n {\n if (location.SourceTree.ReportDocumentationCommentDiagnostics())\n {\n return location;\n }\n }\n return null;\n }\n\n /// \n /// Similar to SymbolExtensions.GetParameters, but returns empty for unsupported symbols\n /// and handles delegates.\n /// \n private static ImmutableArray GetParameters(Symbol symbol)\n {\n switch (symbol.Kind)\n {\n case SymbolKind.NamedType:\n MethodSymbol delegateInvoke = ((NamedTypeSymbol)symbol).DelegateInvokeMethod;\n if ((object)delegateInvoke != null)\n {\n return delegateInvoke.Parameters;\n }\n break;\n case SymbolKind.Method:\n case SymbolKind.Property:\n case SymbolKind.Event:\n return symbol.GetParameters();\n }\n\n return ImmutableArray.Empty;\n }\n\n /// \n /// Similar to SymbolExtensions.GetMemberTypeParameters, but returns empty for unsupported symbols.\n /// \n private static ImmutableArray GetTypeParameters(Symbol symbol)\n {\n switch (symbol.Kind)\n {\n case SymbolKind.Method:\n case SymbolKind.NamedType:\n case SymbolKind.ErrorType:\n return symbol.GetMemberTypeParameters();\n }\n\n return ImmutableArray.Empty;\n }\n\n /// \n /// A symbol requires a documentation comment if it was explicitly declared and\n /// will be visible outside the current assembly (ignoring InternalsVisibleTo).\n /// Exception: accessors do not require doc comments.\n /// \n private static bool RequiresDocumentationComment(Symbol symbol)\n {\n Debug.Assert((object)symbol != null);\n\n if (ShouldSkip(symbol))\n {\n return false;\n }\n\n while ((object)symbol != null)\n {\n switch (symbol.DeclaredAccessibility)\n {\n case Accessibility.Public:\n case Accessibility.Protected:\n case Accessibility.ProtectedOrInternal:\n symbol = symbol.ContainingType;\n break;\n default:\n return false;\n }\n }\n\n return true;\n }\n\n /// \n /// Get all of the DocumentationCommentTriviaSyntax associated with any declaring syntax of the\n /// given symbol (except for partial methods, which only consider the part with the body).\n /// \n /// True if the nodes are all valid XML.\n private bool TryGetDocumentationCommentNodes(Symbol symbol, out DocumentationMode maxDocumentationMode, out ImmutableArray nodes)\n {\n maxDocumentationMode = DocumentationMode.None;\n nodes = default(ImmutableArray);\n\n ArrayBuilder builder = null;\n var diagnosticBag = _diagnostics.DiagnosticBag ?? DiagnosticBag.GetInstance();\n\n foreach (SyntaxReference reference in symbol.DeclaringSyntaxReferences)\n {\n DocumentationMode currDocumentationMode = reference.SyntaxTree.Options.DocumentationMode;\n maxDocumentationMode = currDocumentationMode > maxDocumentationMode ? currDocumentationMode : maxDocumentationMode;\n\n ImmutableArray triviaList = SourceDocumentationCommentUtils.GetDocumentationCommentTriviaFromSyntaxNode((CSharpSyntaxNode)reference.GetSyntax(), diagnosticBag);\n foreach (var trivia in triviaList)\n {\n if (ContainsXmlParseDiagnostic(trivia))\n {\n if (builder != null)\n {\n builder.Free();\n }\n return false;\n }\n\n if (builder == null)\n {\n builder = ArrayBuilder.GetInstance();\n }\n builder.Add(trivia);\n }\n }\n\n if (diagnosticBag != _diagnostics.DiagnosticBag)\n {\n diagnosticBag.Free();\n }\n\n if (builder == null)\n {\n nodes = ImmutableArray.Empty;\n }\n else\n {\n builder.Sort(Comparer);\n nodes = builder.ToImmutableAndFree();\n }\n\n return true;\n }\n\n private static bool ContainsXmlParseDiagnostic(DocumentationCommentTriviaSyntax node)\n {\n if (!node.ContainsDiagnostics)\n {\n return false;\n }\n\n foreach (Diagnostic diag in node.GetDiagnostics())\n {\n if ((ErrorCode)diag.Code == ErrorCode.WRN_XMLParseError)\n {\n return true;\n }\n }\n\n return false;\n }\n\n private static readonly string[] s_newLineSequences = new[] { \"\\r\\n\", \"\\r\", \"\\n\" };\n\n /// \n /// Given the full text of a documentation comment, strip off the comment punctuation (///, /**, etc)\n /// and add appropriate indentations.\n /// \n private string FormatComment(string substitutedText)\n {\n BeginTemporaryString();\n\n if (TrimmedStringStartsWith(substitutedText, \"///\"))\n {\n //Debug.Assert(lines.Take(numLines).All(line => TrimmedStringStartsWith(line, \"///\")));\n WriteFormattedSingleLineComment(substitutedText);\n }\n else\n {\n string[] lines = substitutedText.Split(s_newLineSequences, StringSplitOptions.None);\n\n int numLines = lines.Length;\n Debug.Assert(numLines > 0);\n\n if (string.IsNullOrEmpty(lines[numLines - 1]))\n {\n numLines--;\n Debug.Assert(numLines > 0);\n }\n\n Debug.Assert(TrimmedStringStartsWith(lines[0], \"/**\"));\n WriteFormattedMultiLineComment(lines, numLines);\n }\n\n return GetAndEndTemporaryString();\n }\n\n /// \n /// Given a string, find the index of the first non-whitespace char.\n /// \n /// The string to search\n /// The index of the first non-whitespace char in the string\n private static int GetIndexOfFirstNonWhitespaceChar(string str)\n {\n return GetIndexOfFirstNonWhitespaceChar(str, 0, str.Length);\n }\n\n /// \n /// Find the first non-whitespace character in a given substring.\n /// \n /// The string to search\n /// The start index\n /// The last index (non-inclusive)\n /// The index of the first non-whitespace char after index start in the string up to, but not including the end index\n private static int GetIndexOfFirstNonWhitespaceChar(string str, int start, int end)\n {\n Debug.Assert(start >= 0);\n Debug.Assert(start <= str.Length);\n Debug.Assert(end >= 0);\n Debug.Assert(end <= str.Length);\n Debug.Assert(end >= start);\n\n for (; start < end; start++)\n {\n if (!SyntaxFacts.IsWhitespace(str[start]))\n {\n break;\n }\n }\n\n return start;\n }\n\n /// \n /// Determine if the given string starts with the given prefix if whitespace\n /// is first trimmed from the beginning.\n /// \n /// The string to search\n /// The prefix\n /// true if str.TrimStart().StartsWith(prefix)\n private static bool TrimmedStringStartsWith(string str, string prefix)\n {\n // PERF: Avoid calling string.Trim() because that allocates a new substring\n int start = GetIndexOfFirstNonWhitespaceChar(str);\n int len = str.Length - start;\n if (len < prefix.Length)\n {\n return false;\n }\n\n for (int i = 0; i < prefix.Length; i++)\n {\n if (prefix[i] != str[i + start])\n {\n return false;\n }\n }\n\n return true;\n }\n\n /// \n /// Given a string which may contain newline sequences, get the index of the first newline\n /// sequence beginning at the given starting index.\n /// \n /// The string to split.\n /// The starting index within the string.\n /// The length of the newline sequence discovered. 0 if the end of the string was reached, otherwise either 1 or 2 chars\n /// The index of the start of the first newline sequence following the start index\n private static int IndexOfNewLine(string str, int start, out int newLineLength)\n {\n for (; start < str.Length; start++)\n {\n switch (str[start])\n {\n case '\\r':\n if ((start + 1) < str.Length && str[start + 1] == '\\n')\n {\n newLineLength = 2;\n }\n else\n {\n newLineLength = 1;\n }\n return start;\n\n case '\\n':\n newLineLength = 1;\n return start;\n }\n }\n\n newLineLength = 0;\n return start;\n }\n\n /// \n /// Given the full text of a single-line style documentation comment, for each line, strip off\n /// the comment punctuation (///) and add appropriate indentations.\n /// \n private void WriteFormattedSingleLineComment(string text)\n {\n // PERF: Avoid allocating intermediate strings e.g. via Split, Trim or Substring\n bool skipSpace = true;\n for (int start = 0; start < text.Length;)\n {\n int newLineLength;\n int end = IndexOfNewLine(text, start, out newLineLength);\n int trimStart = GetIndexOfFirstNonWhitespaceChar(text, start, end);\n int trimmedLength = end - trimStart;\n if (trimmedLength < 4 || !SyntaxFacts.IsWhitespace(text[trimStart + 3]))\n {\n skipSpace = false;\n break;\n }\n\n start = end + newLineLength;\n }\n\n int substringStart = skipSpace ? 4 : 3;\n\n for (int start = 0; start < text.Length;)\n {\n int newLineLength;\n int end = IndexOfNewLine(text, start, out newLineLength);\n int trimStart = GetIndexOfFirstNonWhitespaceChar(text, start, end) + substringStart;\n WriteSubStringLine(text, trimStart, end - trimStart);\n start = end + newLineLength;\n }\n }\n\n /// \n /// Given the full text of a multi-line style documentation comment, broken into lines, strip off\n /// the comment punctuation (/**, */, etc) and add appropriate indentations.\n /// \n private void WriteFormattedMultiLineComment(string[] lines, int numLines)\n {\n bool skipFirstLine = lines[0].Trim() == \"/**\";\n bool skipLastLine = lines[numLines - 1].Trim() == \"*/\";\n\n if (skipLastLine)\n {\n numLines--;\n Debug.Assert(numLines > 0);\n }\n\n int skipLength = 0;\n if (numLines > 1)\n {\n string pattern = FindMultiLineCommentPattern(lines[1]);\n\n if (pattern != null)\n {\n bool allMatch = true;\n\n for (int i = 2; i < numLines; i++)\n {\n string currentLinePattern = LongestCommonPrefix(pattern, lines[i]);\n if (string.IsNullOrWhiteSpace(currentLinePattern))\n {\n allMatch = false;\n break;\n }\n Debug.Assert(pattern.StartsWith(currentLinePattern, StringComparison.Ordinal));\n pattern = currentLinePattern;\n }\n\n if (allMatch)\n {\n skipLength = pattern.Length;\n }\n }\n }\n\n if (!skipFirstLine)\n {\n string trimmed = lines[0].TrimStart(null);\n if (!skipLastLine && numLines == 1)\n {\n trimmed = TrimEndOfMultiLineComment(trimmed);\n }\n WriteLine(trimmed.Substring(SyntaxFacts.IsWhitespace(trimmed[3]) ? 4 : 3));\n }\n\n for (int i = 1; i < numLines; i++)\n {\n string trimmed = lines[i].Substring(skipLength);\n\n // If we've already skipped the last line, this can't happen.\n if (!skipLastLine && i == numLines - 1)\n {\n trimmed = TrimEndOfMultiLineComment(trimmed);\n }\n\n WriteLine(trimmed);\n }\n }\n\n /// \n /// Remove \"*/\" and any following text, if it is present.\n /// \n private static string TrimEndOfMultiLineComment(string trimmed)\n {\n int index = trimmed.IndexOf(\"*/\", StringComparison.Ordinal);\n if (index >= 0)\n {\n trimmed = trimmed.Substring(0, index);\n }\n return trimmed;\n }\n\n /// \n /// Return the longest prefix matching [whitespace]*[*][whitespace]*.\n /// \n private static string FindMultiLineCommentPattern(string line)\n {\n int length = 0;\n\n bool seenStar = false;\n foreach (char ch in line)\n {\n if (SyntaxFacts.IsWhitespace(ch))\n {\n length++;\n }\n else if (!seenStar && ch == '*')\n {\n length++;\n seenStar = true;\n }\n else\n {\n break;\n }\n }\n\n return seenStar ? line.Substring(0, length) : null;\n }\n\n /// \n /// Return the longest common prefix of two strings\n /// \n private static string LongestCommonPrefix(string str1, string str2)\n {\n int pos = 0;\n int minLength = Math.Min(str1.Length, str2.Length);\n\n for (; pos < minLength && str1[pos] == str2[pos]; pos++)\n {\n }\n\n return str1.Substring(0, pos);\n }\n\n /// \n /// Bind a CrefSyntax and unwrap the result if it's an alias.\n /// \n /// \n /// Does not respect DocumentationMode, so use a temporary bag if diagnostics are not desired.\n /// \n private static string GetDocumentationCommentId(CrefSyntax crefSyntax, Binder binder, BindingDiagnosticBag diagnostics)\n {\n if (crefSyntax.ContainsDiagnostics)\n {\n return ToBadCrefString(crefSyntax);\n }\n\n Symbol ambiguityWinner;\n ImmutableArray symbols = binder.BindCref(crefSyntax, out ambiguityWinner, diagnostics);\n\n Symbol symbol;\n switch (symbols.Length)\n {\n case 0:\n return ToBadCrefString(crefSyntax);\n case 1:\n symbol = symbols[0];\n break;\n default:\n symbol = ambiguityWinner;\n Debug.Assert((object)symbol != null);\n break;\n }\n\n if (symbol.Kind == SymbolKind.Alias)\n {\n symbol = ((AliasSymbol)symbol).GetAliasTarget(basesBeingResolved: null);\n }\n\n if (symbol is NamespaceSymbol ns)\n {\n Debug.Assert(!ns.IsGlobalNamespace);\n diagnostics.AddAssembliesUsedByNamespaceReference(ns);\n }\n else\n {\n diagnostics.AddDependencies(symbol as TypeSymbol ?? symbol.ContainingType);\n }\n\n return symbol.OriginalDefinition.GetDocumentationCommentId();\n }\n\n /// \n /// Given a cref syntax that cannot be resolved, get the string that will be written to\n /// the documentation file in place of a documentation comment ID.\n /// \n private static string ToBadCrefString(CrefSyntax cref)\n {\n using (StringWriter tmp = new StringWriter(CultureInfo.InvariantCulture))\n {\n cref.WriteTo(tmp);\n return \"!:\" + tmp.ToString().Replace(\"{\", \"<\").Replace(\"}\", \">\");\n }\n }\n\n /// \n /// Bind an XmlNameAttributeSyntax and update the sets of documented parameters and type parameters.\n /// \n /// \n /// Does not respect DocumentationMode, so do not call unless diagnostics are desired.\n /// \n private static void BindName(\n XmlNameAttributeSyntax syntax,\n Binder binder,\n Symbol memberSymbol,\n ref HashSet documentedParameters,\n ref HashSet documentedTypeParameters,\n BindingDiagnosticBag diagnostics)\n {\n XmlNameAttributeElementKind elementKind = syntax.GetElementKind();\n\n // NOTE: We want the corresponding hash set to be non-null if we saw\n // any / elements, even if they didn't bind (for\n // WRN_MissingParamTag and WRN_MissingTypeParamTag).\n if (elementKind == XmlNameAttributeElementKind.Parameter)\n {\n if (documentedParameters == null)\n {\n documentedParameters = new HashSet();\n }\n }\n else if (elementKind == XmlNameAttributeElementKind.TypeParameter)\n {\n if (documentedTypeParameters == null)\n {\n documentedTypeParameters = new HashSet();\n }\n }\n\n IdentifierNameSyntax identifier = syntax.Identifier;\n\n if (identifier.ContainsDiagnostics)\n {\n return;\n }\n\n CompoundUseSiteInfo useSiteInfo = binder.GetNewCompoundUseSiteInfo(diagnostics);\n ImmutableArray referencedSymbols = binder.BindXmlNameAttribute(syntax, ref useSiteInfo);\n diagnostics.Add(syntax, useSiteInfo);\n\n if (referencedSymbols.IsEmpty)\n {\n switch (elementKind)\n {\n case XmlNameAttributeElementKind.Parameter:\n diagnostics.Add(ErrorCode.WRN_UnmatchedParamTag, identifier.Location, identifier);\n break;\n case XmlNameAttributeElementKind.ParameterReference:\n diagnostics.Add(ErrorCode.WRN_UnmatchedParamRefTag, identifier.Location, identifier, memberSymbol);\n break;\n case XmlNameAttributeElementKind.TypeParameter:\n diagnostics.Add(ErrorCode.WRN_UnmatchedTypeParamTag, identifier.Location, identifier);\n break;\n case XmlNameAttributeElementKind.TypeParameterReference:\n diagnostics.Add(ErrorCode.WRN_UnmatchedTypeParamRefTag, identifier.Location, identifier, memberSymbol);\n break;\n default:\n throw ExceptionUtilities.UnexpectedValue(elementKind);\n }\n }\n else\n {\n foreach (Symbol referencedSymbol in referencedSymbols)\n {\n if (elementKind == XmlNameAttributeElementKind.Parameter)\n {\n Debug.Assert(referencedSymbol.Kind == SymbolKind.Parameter);\n Debug.Assert(documentedParameters != null);\n\n // Restriction preserved from dev11: don't report this for the \"value\" parameter.\n // Here, we detect that case by checking the containing symbol - only \"value\"\n // parameters are contained by accessors, others are on the corresponding property/event.\n ParameterSymbol parameter = (ParameterSymbol)referencedSymbol;\n if (!parameter.ContainingSymbol.IsAccessor() && !documentedParameters.Add(parameter))\n {\n diagnostics.Add(ErrorCode.WRN_DuplicateParamTag, syntax.Location, identifier);\n }\n }\n else if (elementKind == XmlNameAttributeElementKind.TypeParameter)\n {\n Debug.Assert(referencedSymbol.Kind == SymbolKind.TypeParameter);\n Debug.Assert(documentedTypeParameters != null);\n\n if (!documentedTypeParameters.Add((TypeParameterSymbol)referencedSymbol))\n {\n diagnostics.Add(ErrorCode.WRN_DuplicateTypeParamTag, syntax.Location, identifier);\n }\n }\n }\n }\n }\n\n private IComparer Comparer\n {\n get\n {\n if (_lazyComparer == null)\n {\n _lazyComparer = new SyntaxNodeLocationComparer(_compilation);\n }\n return _lazyComparer;\n }\n }\n\n private void BeginTemporaryString()\n {\n if (_temporaryStringBuilders == null)\n {\n _temporaryStringBuilders = new Stack();\n }\n\n _temporaryStringBuilders.Push(new TemporaryStringBuilder(_indentDepth));\n }\n\n private string GetAndEndTemporaryString()\n {\n TemporaryStringBuilder t = _temporaryStringBuilders.Pop();\n Debug.Assert(_indentDepth == t.InitialIndentDepth, $\"Temporary strings should be indent-neutral (was {t.InitialIndentDepth}, is {_indentDepth})\");\n _indentDepth = t.InitialIndentDepth;\n return t.Pooled.ToStringAndFree();\n }\n\n private void Indent()\n {\n _indentDepth++;\n }\n\n private void Unindent()\n {\n _indentDepth--;\n Debug.Assert(_indentDepth >= 0);\n }\n\n private void Write(string indentedAndWrappedString)\n {\n if (_temporaryStringBuilders != null && _temporaryStringBuilders.Count > 0)\n {\n StringBuilder builder = _temporaryStringBuilders.Peek().Pooled.Builder;\n builder.Append(indentedAndWrappedString);\n }\n else if (_writer != null)\n {\n _writer.Write(indentedAndWrappedString);\n }\n }\n\n private void WriteLine(string message)\n {\n if (_temporaryStringBuilders?.Count > 0)\n {\n StringBuilder builder = _temporaryStringBuilders.Peek().Pooled.Builder;\n builder.Append(MakeIndent(_indentDepth));\n builder.AppendLine(message);\n }\n else if (_writer != null)\n {\n _writer.Write(MakeIndent(_indentDepth));\n _writer.WriteLine(message);\n }\n }\n\n private void WriteSubStringLine(string message, int start, int length)\n {\n if (_temporaryStringBuilders?.Count > 0)\n {\n StringBuilder builder = _temporaryStringBuilders.Peek().Pooled.Builder;\n builder.Append(MakeIndent(_indentDepth));\n builder.Append(message, start, length);\n builder.AppendLine();\n }\n else if (_writer != null)\n {\n _writer.Write(MakeIndent(_indentDepth));\n for (int i = 0; i < length; i++)\n {\n _writer.Write(message[start + i]);\n }\n _writer.WriteLine();\n }\n }\n\n private void WriteLine(string format, params object[] args)\n {\n WriteLine(string.Format(format, args));\n }\n\n private static string MakeIndent(int depth)\n {\n Debug.Assert(depth >= 0);\n\n // Since we know a lot about the structure of the output,\n // we should be able to do this without constructing any\n // new string objects.\n switch (depth)\n {\n case 0:\n return \"\";\n case 1:\n return \" \";\n case 2:\n return \" \";\n case 3:\n return \" \";\n default:\n Debug.Assert(false, \"Didn't expect nesting to reach depth \" + depth);\n return new string(' ', depth * 4);\n }\n }\n\n /// \n /// WORKAROUND:\n /// We're taking a dependency on the location and structure of a framework assembly resource. This is not a robust solution.\n /// \n /// Possible alternatives:\n /// 1) Polish our XML parser until it matches MSXML. We don't want to reinvent the wheel.\n /// 2) Build a map that lets us go from XML string positions back to source positions. \n /// This is what the native compiler did, and it was a lot of work. We'd also still need to modify the message.\n /// 3) Do not report a diagnostic. This is very unhelpful.\n /// 4) Report a vague diagnostic (i.e. there's a problem somewhere in this doc comment). This is relatively unhelpful.\n /// 5) Always report the message in English, so that we can pull it apart without needing to consume resource files.\n /// This engenders a lot of ill will.\n /// 6) Report the exception message without modification and (optionally) include the text with respect to which the\n /// position is specified. This would not look sufficiently polished.\n /// \n private static string GetDescription(XmlException e)\n {\n string message = e.Message;\n try\n {\n ResourceManager manager = new ResourceManager(\"System.Xml\", typeof(XmlException).GetTypeInfo().Assembly);\n string locationTemplate = manager.GetString(\"Xml_MessageWithErrorPosition\");\n string locationString = string.Format(locationTemplate, \"\", e.LineNumber, e.LinePosition); // first arg is where the problem description goes\n int position = message.IndexOf(locationString, StringComparison.Ordinal); // Expect exact match\n return position < 0\n ? message\n : message.Remove(position, locationString.Length);\n }\n catch\n {\n Debug.Assert(false, \"If we hit this, then we might need to think about a different workaround \" +\n \"for stripping the location out the message.\");\n\n // If anything at all goes wrong, just return the message verbatim. It probably\n // contains an invalid position, but it's better than nothing.\n return message;\n }\n }\n\n private struct TemporaryStringBuilder\n {\n public readonly PooledStringBuilder Pooled;\n public readonly int InitialIndentDepth;\n\n public TemporaryStringBuilder(int indentDepth)\n {\n this.InitialIndentDepth = indentDepth;\n this.Pooled = PooledStringBuilder.GetInstance();\n }\n }\n }\n}\n"},"label":{"kind":"number","value":1,"string":"1"}}},{"rowIdx":835,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56419,"string":"56,419"},"pr_title":{"kind":"string","value":"Fix partial method doc comments"},"pr_description":{"kind":"string","value":"Fixes #54103.\r\n\r\nThe specific rule changes implemented in this PR are laid out in dotnet/csharplang#5193.\r\n\r\nHave added tests to ensure that the expected documentation is shown in Quick Info."},"author":{"kind":"string","value":"RikkiGibson"},"date_created":{"kind":"timestamp","value":"2021-09-15T20:47:39Z","string":"2021-09-15T20:47:39Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T23:49:10Z","string":"2021-09-21T23:49:10Z"},"previous_commit":{"kind":"string","value":"0f60b3e9446f5d0fc14a570998c81a5d6c40cc23"},"pr_commit":{"kind":"string","value":"8cda7462843d43d9b72039eede2f4cb43126cac2"},"query":{"kind":"string","value":"Fix partial method doc comments. Fixes #54103.\r\n\r\nThe specific rule changes implemented in this PR are laid out in dotnet/csharplang#5193.\r\n\r\nHave added tests to ensure that the expected documentation is shown in Quick Info."},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Symbols\n{\n internal sealed class SourceOrdinaryMethodSymbol : SourceOrdinaryMethodSymbolBase\n {\n private readonly TypeSymbol _explicitInterfaceType;\n private readonly bool _isExpressionBodied;\n private readonly bool _hasAnyBody;\n private readonly RefKind _refKind;\n private bool _lazyIsVararg;\n\n /// \n /// A collection of type parameter constraint types, populated when\n /// constraint types for the first type parameter is requested.\n /// Initialized in two steps. Hold a copy if accessing during initialization.\n /// \n private ImmutableArray> _lazyTypeParameterConstraintTypes;\n\n /// \n /// A collection of type parameter constraint kinds, populated when\n /// constraint kinds for the first type parameter is requested.\n /// Initialized in two steps. Hold a copy if accessing during initialization.\n /// \n private ImmutableArray _lazyTypeParameterConstraintKinds;\n\n /// \n /// If this symbol represents a partial method definition or implementation part, its other part (if any).\n /// This should be set, if at all, before this symbol appears among the members of its owner. \n /// The implementation part is not listed among the \"members\" of the enclosing type.\n /// \n private SourceOrdinaryMethodSymbol _otherPartOfPartial;\n\n public static SourceOrdinaryMethodSymbol CreateMethodSymbol(\n NamedTypeSymbol containingType,\n Binder bodyBinder,\n MethodDeclarationSyntax syntax,\n bool isNullableAnalysisEnabled,\n BindingDiagnosticBag diagnostics)\n {\n var interfaceSpecifier = syntax.ExplicitInterfaceSpecifier;\n var nameToken = syntax.Identifier;\n\n TypeSymbol explicitInterfaceType;\n var name = ExplicitInterfaceHelpers.GetMemberNameAndInterfaceSymbol(bodyBinder, interfaceSpecifier, nameToken.ValueText, diagnostics, out explicitInterfaceType, aliasQualifierOpt: out _);\n var location = new SourceLocation(nameToken);\n\n var methodKind = interfaceSpecifier == null\n ? MethodKind.Ordinary\n : MethodKind.ExplicitInterfaceImplementation;\n\n return new SourceOrdinaryMethodSymbol(containingType, explicitInterfaceType, name, location, syntax, methodKind, isNullableAnalysisEnabled, diagnostics);\n }\n\n private SourceOrdinaryMethodSymbol(\n NamedTypeSymbol containingType,\n TypeSymbol explicitInterfaceType,\n string name,\n Location location,\n MethodDeclarationSyntax syntax,\n MethodKind methodKind,\n bool isNullableAnalysisEnabled,\n BindingDiagnosticBag diagnostics) :\n base(containingType,\n name,\n location,\n syntax,\n methodKind,\n isIterator: SyntaxFacts.HasYieldOperations(syntax.Body),\n isExtensionMethod: syntax.ParameterList.Parameters.FirstOrDefault() is ParameterSyntax firstParam &&\n !firstParam.IsArgList &&\n firstParam.Modifiers.Any(SyntaxKind.ThisKeyword),\n isPartial: syntax.Modifiers.IndexOf(SyntaxKind.PartialKeyword) < 0,\n isReadOnly: false,\n hasBody: syntax.Body != null || syntax.ExpressionBody != null,\n isNullableAnalysisEnabled: isNullableAnalysisEnabled,\n diagnostics)\n {\n Debug.Assert(diagnostics.DiagnosticBag is object);\n\n _explicitInterfaceType = explicitInterfaceType;\n\n bool hasBlockBody = syntax.Body != null;\n _isExpressionBodied = !hasBlockBody && syntax.ExpressionBody != null;\n bool hasBody = hasBlockBody || _isExpressionBodied;\n _hasAnyBody = hasBody;\n _refKind = syntax.ReturnType.GetRefKind();\n\n CheckForBlockAndExpressionBody(\n syntax.Body, syntax.ExpressionBody, syntax, diagnostics);\n }\n\n protected override ImmutableArray MakeTypeParameters(CSharpSyntaxNode node, BindingDiagnosticBag diagnostics)\n {\n var syntax = (MethodDeclarationSyntax)node;\n if (syntax.Arity == 0)\n {\n ReportErrorIfHasConstraints(syntax.ConstraintClauses, diagnostics.DiagnosticBag);\n return ImmutableArray.Empty;\n }\n else\n {\n return MakeTypeParameters(syntax, diagnostics);\n }\n }\n\n protected override (TypeWithAnnotations ReturnType, ImmutableArray Parameters, bool IsVararg, ImmutableArray DeclaredConstraintsForOverrideOrImplementation) MakeParametersAndBindReturnType(BindingDiagnosticBag diagnostics)\n {\n var syntax = GetSyntax();\n var withTypeParamsBinder = this.DeclaringCompilation.GetBinderFactory(syntax.SyntaxTree).GetBinder(syntax.ReturnType, syntax, this);\n\n SyntaxToken arglistToken;\n\n // Constraint checking for parameter and return types must be delayed until\n // the method has been added to the containing type member list since\n // evaluating the constraints may depend on accessing this method from\n // the container (comparing this method to others to find overrides for\n // instance). Constraints are checked in AfterAddingTypeMembersChecks.\n var signatureBinder = withTypeParamsBinder.WithAdditionalFlagsAndContainingMemberOrLambda(BinderFlags.SuppressConstraintChecks, this);\n\n ImmutableArray parameters = ParameterHelpers.MakeParameters(\n signatureBinder, this, syntax.ParameterList, out arglistToken,\n allowRefOrOut: true,\n allowThis: true,\n addRefReadOnlyModifier: IsVirtual || IsAbstract,\n diagnostics: diagnostics);\n\n _lazyIsVararg = (arglistToken.Kind() == SyntaxKind.ArgListKeyword);\n RefKind refKind;\n var returnTypeSyntax = syntax.ReturnType.SkipRef(out refKind);\n TypeWithAnnotations returnType = signatureBinder.BindType(returnTypeSyntax, diagnostics);\n\n // span-like types are returnable in general\n if (returnType.IsRestrictedType(ignoreSpanLikeTypes: true))\n {\n if (returnType.SpecialType == SpecialType.System_TypedReference &&\n (this.ContainingType.SpecialType == SpecialType.System_TypedReference || this.ContainingType.SpecialType == SpecialType.System_ArgIterator))\n {\n // Two special cases: methods in the special types TypedReference and ArgIterator are allowed to return TypedReference\n }\n else\n {\n // The return type of a method, delegate, or function pointer cannot be '{0}'\n diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, syntax.ReturnType.Location, returnType.Type);\n }\n }\n\n Debug.Assert(this.RefKind == RefKind.None || !returnType.IsVoidType() || returnTypeSyntax.HasErrors);\n\n ImmutableArray declaredConstraints = default;\n\n if (this.Arity != 0 && (syntax.ExplicitInterfaceSpecifier != null || IsOverride))\n {\n // When a generic method overrides a generic method declared in a base class, or is an \n // explicit interface member implementation of a method in a base interface, the method\n // shall not specify any type-parameter-constraints-clauses, except for a struct, class, or default constraint.\n // In these cases, the type parameters of the method inherit constraints from the method being overridden or \n // implemented.\n if (syntax.ConstraintClauses.Count > 0)\n {\n Binder.CheckFeatureAvailability(syntax.SyntaxTree, MessageID.IDS_OverrideWithConstraints, diagnostics,\n syntax.ConstraintClauses[0].WhereKeyword.GetLocation());\n\n declaredConstraints = signatureBinder.WithAdditionalFlags(BinderFlags.GenericConstraintsClause | BinderFlags.SuppressConstraintChecks).\n BindTypeParameterConstraintClauses(this, TypeParameters, syntax.TypeParameterList, syntax.ConstraintClauses,\n diagnostics, performOnlyCycleSafeValidation: false, isForOverride: true);\n Debug.Assert(declaredConstraints.All(clause => clause.ConstraintTypes.IsEmpty));\n }\n\n // Force resolution of nullable type parameter used in the signature of an override or explicit interface implementation\n // based on constraints specified by the declaration.\n foreach (var param in parameters)\n {\n forceMethodTypeParameters(param.TypeWithAnnotations, this, declaredConstraints);\n }\n\n forceMethodTypeParameters(returnType, this, declaredConstraints);\n }\n\n return (returnType, parameters, _lazyIsVararg, declaredConstraints);\n\n static void forceMethodTypeParameters(TypeWithAnnotations type, SourceOrdinaryMethodSymbol method, ImmutableArray declaredConstraints)\n {\n type.VisitType(null, (type, args, unused2) =>\n {\n if (type.DefaultType is TypeParameterSymbol typeParameterSymbol && typeParameterSymbol.DeclaringMethod == (object)args.method)\n {\n var asValueType = args.declaredConstraints.IsDefault ||\n (args.declaredConstraints[typeParameterSymbol.Ordinal].Constraints & (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.Default)) == 0;\n type.TryForceResolve(asValueType);\n }\n return false;\n }, typePredicate: null, arg: (method, declaredConstraints), canDigThroughNullable: false, useDefaultType: true);\n }\n }\n\n protected override void ExtensionMethodChecks(BindingDiagnosticBag diagnostics)\n {\n // errors relevant for extension methods\n if (IsExtensionMethod)\n {\n var syntax = GetSyntax();\n var location = locations[0];\n var parameter0Type = this.Parameters[0].TypeWithAnnotations;\n var parameter0RefKind = this.Parameters[0].RefKind;\n if (!parameter0Type.Type.IsValidExtensionParameterType())\n {\n // Duplicate Dev10 behavior by selecting the parameter type.\n var parameterSyntax = syntax.ParameterList.Parameters[0];\n Debug.Assert(parameterSyntax.Type != null);\n var loc = parameterSyntax.Type.Location;\n diagnostics.Add(ErrorCode.ERR_BadTypeforThis, loc, parameter0Type.Type);\n }\n else if (parameter0RefKind == RefKind.Ref && !parameter0Type.Type.IsValueType)\n {\n diagnostics.Add(ErrorCode.ERR_RefExtensionMustBeValueTypeOrConstrainedToOne, location, Name);\n }\n else if (parameter0RefKind == RefKind.In && parameter0Type.TypeKind != TypeKind.Struct)\n {\n diagnostics.Add(ErrorCode.ERR_InExtensionMustBeValueType, location, Name);\n }\n else if ((object)ContainingType.ContainingType != null)\n {\n diagnostics.Add(ErrorCode.ERR_ExtensionMethodsDecl, location, ContainingType.Name);\n }\n else if (!ContainingType.IsScriptClass && !(ContainingType.IsStatic && ContainingType.Arity == 0))\n {\n // Duplicate Dev10 behavior by selecting the containing type identifier. However if there\n // is no containing type (in the interactive case for instance), select the method identifier.\n var typeDecl = syntax.Parent as TypeDeclarationSyntax;\n var identifier = (typeDecl != null) ? typeDecl.Identifier : syntax.Identifier;\n var loc = identifier.GetLocation();\n diagnostics.Add(ErrorCode.ERR_BadExtensionAgg, loc);\n }\n else if (!IsStatic)\n {\n diagnostics.Add(ErrorCode.ERR_BadExtensionMeth, location);\n }\n else\n {\n // Verify ExtensionAttribute is available.\n var attributeConstructor = Binder.GetWellKnownTypeMember(DeclaringCompilation, WellKnownMember.System_Runtime_CompilerServices_ExtensionAttribute__ctor, out var useSiteInfo);\n Location thisLocation = syntax.ParameterList.Parameters[0].Modifiers.FirstOrDefault(SyntaxKind.ThisKeyword).GetLocation();\n if ((object)attributeConstructor == null)\n {\n var memberDescriptor = WellKnownMembers.GetDescriptor(WellKnownMember.System_Runtime_CompilerServices_ExtensionAttribute__ctor);\n // do not use Binder.ReportUseSiteErrorForAttributeCtor in this case, because we'll need to report a special error id, not a generic use site error.\n diagnostics.Add(\n ErrorCode.ERR_ExtensionAttrNotFound,\n thisLocation,\n memberDescriptor.DeclaringTypeMetadataName);\n }\n else\n {\n diagnostics.Add(useSiteInfo, thisLocation);\n }\n }\n }\n }\n\n protected override MethodSymbol FindExplicitlyImplementedMethod(BindingDiagnosticBag diagnostics)\n {\n var syntax = GetSyntax();\n return this.FindExplicitlyImplementedMethod(isOperator: false, _explicitInterfaceType, syntax.Identifier.ValueText, syntax.ExplicitInterfaceSpecifier, diagnostics);\n }\n\n protected override Location ReturnTypeLocation => GetSyntax().ReturnType.Location;\n\n protected override TypeSymbol ExplicitInterfaceType => _explicitInterfaceType;\n\n protected override bool HasAnyBody => _hasAnyBody;\n\n internal MethodDeclarationSyntax GetSyntax()\n {\n Debug.Assert(syntaxReferenceOpt != null);\n return (MethodDeclarationSyntax)syntaxReferenceOpt.GetSyntax();\n }\n\n protected override void CompleteAsyncMethodChecksBetweenStartAndFinish()\n {\n if (IsPartialDefinition)\n {\n DeclaringCompilation.SymbolDeclaredEvent(this);\n }\n }\n\n public override ImmutableArray> GetTypeParameterConstraintTypes()\n {\n if (_lazyTypeParameterConstraintTypes.IsDefault)\n {\n GetTypeParameterConstraintKinds();\n\n var diagnostics = BindingDiagnosticBag.GetInstance();\n var syntax = GetSyntax();\n var withTypeParametersBinder =\n this.DeclaringCompilation\n .GetBinderFactory(syntax.SyntaxTree)\n .GetBinder(syntax.ReturnType, syntax, this);\n var constraints = this.MakeTypeParameterConstraintTypes(\n withTypeParametersBinder,\n TypeParameters,\n syntax.TypeParameterList,\n syntax.ConstraintClauses,\n diagnostics);\n if (ImmutableInterlocked.InterlockedInitialize(ref _lazyTypeParameterConstraintTypes, constraints))\n {\n this.AddDeclarationDiagnostics(diagnostics);\n }\n diagnostics.Free();\n }\n\n return _lazyTypeParameterConstraintTypes;\n }\n\n public override ImmutableArray GetTypeParameterConstraintKinds()\n {\n if (_lazyTypeParameterConstraintKinds.IsDefault)\n {\n var syntax = GetSyntax();\n var withTypeParametersBinder =\n this.DeclaringCompilation\n .GetBinderFactory(syntax.SyntaxTree)\n .GetBinder(syntax.ReturnType, syntax, this);\n var constraints = this.MakeTypeParameterConstraintKinds(\n withTypeParametersBinder,\n TypeParameters,\n syntax.TypeParameterList,\n syntax.ConstraintClauses);\n\n ImmutableInterlocked.InterlockedInitialize(ref _lazyTypeParameterConstraintKinds, constraints);\n }\n\n return _lazyTypeParameterConstraintKinds;\n }\n\n public override bool IsVararg\n {\n get\n {\n LazyMethodChecks();\n return _lazyIsVararg;\n }\n }\n\n protected override int GetParameterCountFromSyntax() => GetSyntax().ParameterList.ParameterCount;\n\n public override RefKind RefKind\n {\n get\n {\n return _refKind;\n }\n }\n\n internal static void InitializePartialMethodParts(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation)\n {\n Debug.Assert(definition.IsPartialDefinition);\n Debug.Assert(implementation.IsPartialImplementation);\n Debug.Assert((object)definition._otherPartOfPartial == null || (object)definition._otherPartOfPartial == implementation);\n Debug.Assert((object)implementation._otherPartOfPartial == null || (object)implementation._otherPartOfPartial == definition);\n\n definition._otherPartOfPartial = implementation;\n implementation._otherPartOfPartial = definition;\n }\n\n /// \n /// If this is a partial implementation part returns the definition part and vice versa.\n /// \n internal SourceOrdinaryMethodSymbol OtherPartOfPartial\n {\n get { return _otherPartOfPartial; }\n }\n\n /// \n /// Returns true if this symbol represents a partial method definition (the part that specifies a signature but no body).\n /// \n internal bool IsPartialDefinition\n {\n get\n {\n return this.IsPartial && !_hasAnyBody && !HasExternModifier;\n }\n }\n\n /// \n /// Returns true if this symbol represents a partial method implementation (the part that specifies both signature and body).\n /// \n internal bool IsPartialImplementation\n {\n get\n {\n return this.IsPartial && (_hasAnyBody || HasExternModifier);\n }\n }\n\n /// \n /// True if this is a partial method that doesn't have an implementation part.\n /// \n internal bool IsPartialWithoutImplementation\n {\n get\n {\n return this.IsPartialDefinition && (object)_otherPartOfPartial == null;\n }\n }\n\n /// \n /// Returns the implementation part of a partial method definition, \n /// or null if this is not a partial method or it is the definition part.\n /// \n internal SourceOrdinaryMethodSymbol SourcePartialDefinition\n {\n get\n {\n return this.IsPartialImplementation ? _otherPartOfPartial : null;\n }\n }\n\n /// \n /// Returns the definition part of a partial method implementation, \n /// or null if this is not a partial method or it is the implementation part.\n /// \n internal SourceOrdinaryMethodSymbol SourcePartialImplementation\n {\n get\n {\n return this.IsPartialDefinition ? _otherPartOfPartial : null;\n }\n }\n\n public override MethodSymbol PartialDefinitionPart\n {\n get\n {\n return SourcePartialDefinition;\n }\n }\n\n public override MethodSymbol PartialImplementationPart\n {\n get\n {\n return SourcePartialImplementation;\n }\n }\n\n public sealed override bool IsExtern\n {\n get\n {\n return IsPartialDefinition\n ? _otherPartOfPartial?.IsExtern ?? false\n : HasExternModifier;\n }\n }\n\n public override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default(CancellationToken))\n {\n ref var lazyDocComment = ref expandIncludes ? ref this.lazyExpandedDocComment : ref this.lazyDocComment;\n return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(SourcePartialImplementation ?? this, expandIncludes, ref lazyDocComment);\n }\n\n protected override SourceMemberMethodSymbol BoundAttributesSource\n {\n get\n {\n return this.SourcePartialDefinition;\n }\n }\n\n internal override OneOrMany> GetAttributeDeclarations()\n {\n if ((object)this.SourcePartialImplementation != null)\n {\n return OneOrMany.Create(ImmutableArray.Create(AttributeDeclarationSyntaxList, this.SourcePartialImplementation.AttributeDeclarationSyntaxList));\n }\n else\n {\n return OneOrMany.Create(AttributeDeclarationSyntaxList);\n }\n }\n\n private SyntaxList AttributeDeclarationSyntaxList\n {\n get\n {\n var sourceContainer = this.ContainingType as SourceMemberContainerTypeSymbol;\n if ((object)sourceContainer != null && sourceContainer.AnyMemberHasAttributes)\n {\n return this.GetSyntax().AttributeLists;\n }\n\n return default(SyntaxList);\n }\n }\n\n internal override bool IsExpressionBodied\n {\n get { return _isExpressionBodied; }\n }\n\n protected override DeclarationModifiers MakeDeclarationModifiers(DeclarationModifiers allowedModifiers, BindingDiagnosticBag diagnostics)\n {\n var syntax = GetSyntax();\n return ModifierUtils.MakeAndCheckNontypeMemberModifiers(syntax.Modifiers, defaultAccess: DeclarationModifiers.None, allowedModifiers, Locations[0], diagnostics, out _);\n }\n\n private ImmutableArray MakeTypeParameters(MethodDeclarationSyntax syntax, BindingDiagnosticBag diagnostics)\n {\n Debug.Assert(syntax.TypeParameterList != null);\n\n OverriddenMethodTypeParameterMapBase typeMap = null;\n if (this.IsOverride)\n {\n typeMap = new OverriddenMethodTypeParameterMap(this);\n }\n else if (this.IsExplicitInterfaceImplementation)\n {\n typeMap = new ExplicitInterfaceMethodTypeParameterMap(this);\n }\n\n var typeParameters = syntax.TypeParameterList.Parameters;\n var result = ArrayBuilder.GetInstance();\n\n for (int ordinal = 0; ordinal < typeParameters.Count; ordinal++)\n {\n var parameter = typeParameters[ordinal];\n if (parameter.VarianceKeyword.Kind() != SyntaxKind.None)\n {\n diagnostics.Add(ErrorCode.ERR_IllegalVarianceSyntax, parameter.VarianceKeyword.GetLocation());\n }\n\n var identifier = parameter.Identifier;\n var location = identifier.GetLocation();\n var name = identifier.ValueText;\n\n // Note: It is not an error to have a type parameter named the same as its enclosing method: void M() {}\n\n for (int i = 0; i < result.Count; i++)\n {\n if (name == result[i].Name)\n {\n diagnostics.Add(ErrorCode.ERR_DuplicateTypeParameter, location, name);\n break;\n }\n }\n\n SourceMemberContainerTypeSymbol.ReportTypeNamedRecord(identifier.Text, this.DeclaringCompilation, diagnostics.DiagnosticBag, location);\n\n var tpEnclosing = ContainingType.FindEnclosingTypeParameter(name);\n if ((object)tpEnclosing != null)\n {\n // Type parameter '{0}' has the same name as the type parameter from outer type '{1}'\n diagnostics.Add(ErrorCode.WRN_TypeParameterSameAsOuterTypeParameter, location, name, tpEnclosing.ContainingType);\n }\n\n var syntaxRefs = ImmutableArray.Create(parameter.GetReference());\n var locations = ImmutableArray.Create(location);\n var typeParameter = (typeMap != null) ?\n (TypeParameterSymbol)new SourceOverridingMethodTypeParameterSymbol(\n typeMap,\n name,\n ordinal,\n locations,\n syntaxRefs) :\n new SourceMethodTypeParameterSymbol(\n this,\n name,\n ordinal,\n locations,\n syntaxRefs);\n\n result.Add(typeParameter);\n }\n\n return result.ToImmutableAndFree();\n }\n\n internal override void ForceComplete(SourceLocation locationOpt, CancellationToken cancellationToken)\n {\n var implementingPart = this.SourcePartialImplementation;\n if ((object)implementingPart != null)\n {\n implementingPart.ForceComplete(locationOpt, cancellationToken);\n }\n\n base.ForceComplete(locationOpt, cancellationToken);\n }\n\n internal override bool IsDefinedInSourceTree(\n SyntaxTree tree,\n TextSpan? definedWithinSpan,\n CancellationToken cancellationToken = default(CancellationToken))\n {\n // Since only the declaring (and not the implementing) part of a partial method appears in the member\n // list, we need to ensure we complete the implementation part when needed.\n return\n base.IsDefinedInSourceTree(tree, definedWithinSpan, cancellationToken) ||\n this.SourcePartialImplementation?.IsDefinedInSourceTree(tree, definedWithinSpan, cancellationToken) == true;\n }\n\n protected override void CheckConstraintsForExplicitInterfaceType(ConversionsBase conversions, BindingDiagnosticBag diagnostics)\n {\n if ((object)_explicitInterfaceType != null)\n {\n var syntax = this.GetSyntax();\n Debug.Assert(syntax.ExplicitInterfaceSpecifier != null);\n _explicitInterfaceType.CheckAllConstraints(DeclaringCompilation, conversions, new SourceLocation(syntax.ExplicitInterfaceSpecifier.Name), diagnostics);\n }\n }\n\n protected override void PartialMethodChecks(BindingDiagnosticBag diagnostics)\n {\n var implementingPart = this.SourcePartialImplementation;\n if ((object)implementingPart != null)\n {\n PartialMethodChecks(this, implementingPart, diagnostics);\n }\n }\n\n /// \n /// Report differences between the defining and implementing\n /// parts of a partial method. Diagnostics are reported on the\n /// implementing part, matching Dev10 behavior.\n /// \n private static void PartialMethodChecks(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation, BindingDiagnosticBag diagnostics)\n {\n Debug.Assert(!ReferenceEquals(definition, implementation));\n\n MethodSymbol constructedDefinition = definition.ConstructIfGeneric(TypeMap.TypeParametersAsTypeSymbolsWithIgnoredAnnotations(implementation.TypeParameters));\n bool hasTypeDifferences = !constructedDefinition.ReturnTypeWithAnnotations.Equals(implementation.ReturnTypeWithAnnotations, TypeCompareKind.AllIgnoreOptions);\n if (hasTypeDifferences)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodReturnTypeDifference, implementation.Locations[0]);\n }\n else if (MemberSignatureComparer.ConsideringTupleNamesCreatesDifference(definition, implementation))\n {\n hasTypeDifferences = true;\n diagnostics.Add(ErrorCode.ERR_PartialMethodInconsistentTupleNames, implementation.Locations[0], definition, implementation);\n }\n\n if (definition.RefKind != implementation.RefKind)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodRefReturnDifference, implementation.Locations[0]);\n }\n\n if (definition.IsStatic != implementation.IsStatic)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodStaticDifference, implementation.Locations[0]);\n }\n\n if (definition.IsDeclaredReadOnly != implementation.IsDeclaredReadOnly)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodReadOnlyDifference, implementation.Locations[0]);\n }\n\n if (definition.IsExtensionMethod != implementation.IsExtensionMethod)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodExtensionDifference, implementation.Locations[0]);\n }\n\n if (definition.IsUnsafe != implementation.IsUnsafe && definition.CompilationAllowsUnsafe()) // Don't cascade.\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodUnsafeDifference, implementation.Locations[0]);\n }\n\n if (definition.IsParams() != implementation.IsParams())\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodParamsDifference, implementation.Locations[0]);\n }\n\n if (definition.HasExplicitAccessModifier != implementation.HasExplicitAccessModifier\n || definition.DeclaredAccessibility != implementation.DeclaredAccessibility)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodAccessibilityDifference, implementation.Locations[0]);\n }\n\n if (definition.IsVirtual != implementation.IsVirtual\n || definition.IsOverride != implementation.IsOverride\n || definition.IsSealed != implementation.IsSealed\n || definition.IsNew != implementation.IsNew)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodExtendedModDifference, implementation.Locations[0]);\n }\n\n PartialMethodConstraintsChecks(definition, implementation, diagnostics);\n\n if (SourceMemberContainerTypeSymbol.CheckValidNullableMethodOverride(\n implementation.DeclaringCompilation,\n constructedDefinition,\n implementation,\n diagnostics,\n static (diagnostics, implementedMethod, implementingMethod, topLevel, arg) =>\n {\n // report only if this is an unsafe *nullability* difference\n diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnPartial, implementingMethod.Locations[0]);\n },\n static (diagnostics, implementedMethod, implementingMethod, implementingParameter, blameAttributes, arg) =>\n {\n diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnPartial, implementingMethod.Locations[0], new FormattedSymbol(implementingParameter, SymbolDisplayFormat.ShortFormat));\n },\n extraArgument: (object)null))\n {\n hasTypeDifferences = true;\n }\n\n if ((!hasTypeDifferences && !MemberSignatureComparer.PartialMethodsStrictComparer.Equals(definition, implementation)) ||\n hasDifferencesInParameterOrTypeParameterName(definition, implementation))\n {\n diagnostics.Add(ErrorCode.WRN_PartialMethodTypeDifference, implementation.Locations[0],\n new FormattedSymbol(definition, SymbolDisplayFormat.MinimallyQualifiedFormat),\n new FormattedSymbol(implementation, SymbolDisplayFormat.MinimallyQualifiedFormat));\n }\n\n static bool hasDifferencesInParameterOrTypeParameterName(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation)\n {\n return !definition.Parameters.SequenceEqual(implementation.Parameters, (a, b) => a.Name == b.Name) ||\n !definition.TypeParameters.SequenceEqual(implementation.TypeParameters, (a, b) => a.Name == b.Name);\n }\n }\n\n private static void PartialMethodConstraintsChecks(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation, BindingDiagnosticBag diagnostics)\n {\n Debug.Assert(!ReferenceEquals(definition, implementation));\n Debug.Assert(definition.Arity == implementation.Arity);\n\n var typeParameters1 = definition.TypeParameters;\n\n int arity = typeParameters1.Length;\n if (arity == 0)\n {\n return;\n }\n\n var typeParameters2 = implementation.TypeParameters;\n var indexedTypeParameters = IndexedTypeParameterSymbol.Take(arity);\n var typeMap1 = new TypeMap(typeParameters1, indexedTypeParameters, allowAlpha: true);\n var typeMap2 = new TypeMap(typeParameters2, indexedTypeParameters, allowAlpha: true);\n\n // Report any mismatched method constraints.\n for (int i = 0; i < arity; i++)\n {\n var typeParameter1 = typeParameters1[i];\n var typeParameter2 = typeParameters2[i];\n\n if (!MemberSignatureComparer.HaveSameConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2))\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodInconsistentConstraints, implementation.Locations[0], implementation, typeParameter2.Name);\n }\n else if (!MemberSignatureComparer.HaveSameNullabilityInConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2))\n {\n diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation, implementation.Locations[0], implementation, typeParameter2.Name);\n }\n }\n }\n\n internal override bool CallsAreOmitted(SyntaxTree syntaxTree)\n {\n if (this.IsPartialWithoutImplementation)\n {\n return true;\n }\n\n return base.CallsAreOmitted(syntaxTree);\n }\n\n internal override bool GenerateDebugInfo => !IsAsync && !IsIterator;\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.Linq;\nusing System.Threading;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp.Symbols\n{\n internal sealed class SourceOrdinaryMethodSymbol : SourceOrdinaryMethodSymbolBase\n {\n private readonly TypeSymbol _explicitInterfaceType;\n private readonly bool _isExpressionBodied;\n private readonly bool _hasAnyBody;\n private readonly RefKind _refKind;\n private bool _lazyIsVararg;\n\n /// \n /// A collection of type parameter constraint types, populated when\n /// constraint types for the first type parameter is requested.\n /// Initialized in two steps. Hold a copy if accessing during initialization.\n /// \n private ImmutableArray> _lazyTypeParameterConstraintTypes;\n\n /// \n /// A collection of type parameter constraint kinds, populated when\n /// constraint kinds for the first type parameter is requested.\n /// Initialized in two steps. Hold a copy if accessing during initialization.\n /// \n private ImmutableArray _lazyTypeParameterConstraintKinds;\n\n /// \n /// If this symbol represents a partial method definition or implementation part, its other part (if any).\n /// This should be set, if at all, before this symbol appears among the members of its owner. \n /// The implementation part is not listed among the \"members\" of the enclosing type.\n /// \n private SourceOrdinaryMethodSymbol _otherPartOfPartial;\n\n public static SourceOrdinaryMethodSymbol CreateMethodSymbol(\n NamedTypeSymbol containingType,\n Binder bodyBinder,\n MethodDeclarationSyntax syntax,\n bool isNullableAnalysisEnabled,\n BindingDiagnosticBag diagnostics)\n {\n var interfaceSpecifier = syntax.ExplicitInterfaceSpecifier;\n var nameToken = syntax.Identifier;\n\n TypeSymbol explicitInterfaceType;\n var name = ExplicitInterfaceHelpers.GetMemberNameAndInterfaceSymbol(bodyBinder, interfaceSpecifier, nameToken.ValueText, diagnostics, out explicitInterfaceType, aliasQualifierOpt: out _);\n var location = new SourceLocation(nameToken);\n\n var methodKind = interfaceSpecifier == null\n ? MethodKind.Ordinary\n : MethodKind.ExplicitInterfaceImplementation;\n\n return new SourceOrdinaryMethodSymbol(containingType, explicitInterfaceType, name, location, syntax, methodKind, isNullableAnalysisEnabled, diagnostics);\n }\n\n private SourceOrdinaryMethodSymbol(\n NamedTypeSymbol containingType,\n TypeSymbol explicitInterfaceType,\n string name,\n Location location,\n MethodDeclarationSyntax syntax,\n MethodKind methodKind,\n bool isNullableAnalysisEnabled,\n BindingDiagnosticBag diagnostics) :\n base(containingType,\n name,\n location,\n syntax,\n methodKind,\n isIterator: SyntaxFacts.HasYieldOperations(syntax.Body),\n isExtensionMethod: syntax.ParameterList.Parameters.FirstOrDefault() is ParameterSyntax firstParam &&\n !firstParam.IsArgList &&\n firstParam.Modifiers.Any(SyntaxKind.ThisKeyword),\n isPartial: syntax.Modifiers.IndexOf(SyntaxKind.PartialKeyword) < 0,\n isReadOnly: false,\n hasBody: syntax.Body != null || syntax.ExpressionBody != null,\n isNullableAnalysisEnabled: isNullableAnalysisEnabled,\n diagnostics)\n {\n Debug.Assert(diagnostics.DiagnosticBag is object);\n\n _explicitInterfaceType = explicitInterfaceType;\n\n bool hasBlockBody = syntax.Body != null;\n _isExpressionBodied = !hasBlockBody && syntax.ExpressionBody != null;\n bool hasBody = hasBlockBody || _isExpressionBodied;\n _hasAnyBody = hasBody;\n _refKind = syntax.ReturnType.GetRefKind();\n\n CheckForBlockAndExpressionBody(\n syntax.Body, syntax.ExpressionBody, syntax, diagnostics);\n }\n\n protected override ImmutableArray MakeTypeParameters(CSharpSyntaxNode node, BindingDiagnosticBag diagnostics)\n {\n var syntax = (MethodDeclarationSyntax)node;\n if (syntax.Arity == 0)\n {\n ReportErrorIfHasConstraints(syntax.ConstraintClauses, diagnostics.DiagnosticBag);\n return ImmutableArray.Empty;\n }\n else\n {\n return MakeTypeParameters(syntax, diagnostics);\n }\n }\n\n protected override (TypeWithAnnotations ReturnType, ImmutableArray Parameters, bool IsVararg, ImmutableArray DeclaredConstraintsForOverrideOrImplementation) MakeParametersAndBindReturnType(BindingDiagnosticBag diagnostics)\n {\n var syntax = GetSyntax();\n var withTypeParamsBinder = this.DeclaringCompilation.GetBinderFactory(syntax.SyntaxTree).GetBinder(syntax.ReturnType, syntax, this);\n\n SyntaxToken arglistToken;\n\n // Constraint checking for parameter and return types must be delayed until\n // the method has been added to the containing type member list since\n // evaluating the constraints may depend on accessing this method from\n // the container (comparing this method to others to find overrides for\n // instance). Constraints are checked in AfterAddingTypeMembersChecks.\n var signatureBinder = withTypeParamsBinder.WithAdditionalFlagsAndContainingMemberOrLambda(BinderFlags.SuppressConstraintChecks, this);\n\n ImmutableArray parameters = ParameterHelpers.MakeParameters(\n signatureBinder, this, syntax.ParameterList, out arglistToken,\n allowRefOrOut: true,\n allowThis: true,\n addRefReadOnlyModifier: IsVirtual || IsAbstract,\n diagnostics: diagnostics);\n\n _lazyIsVararg = (arglistToken.Kind() == SyntaxKind.ArgListKeyword);\n RefKind refKind;\n var returnTypeSyntax = syntax.ReturnType.SkipRef(out refKind);\n TypeWithAnnotations returnType = signatureBinder.BindType(returnTypeSyntax, diagnostics);\n\n // span-like types are returnable in general\n if (returnType.IsRestrictedType(ignoreSpanLikeTypes: true))\n {\n if (returnType.SpecialType == SpecialType.System_TypedReference &&\n (this.ContainingType.SpecialType == SpecialType.System_TypedReference || this.ContainingType.SpecialType == SpecialType.System_ArgIterator))\n {\n // Two special cases: methods in the special types TypedReference and ArgIterator are allowed to return TypedReference\n }\n else\n {\n // The return type of a method, delegate, or function pointer cannot be '{0}'\n diagnostics.Add(ErrorCode.ERR_MethodReturnCantBeRefAny, syntax.ReturnType.Location, returnType.Type);\n }\n }\n\n Debug.Assert(this.RefKind == RefKind.None || !returnType.IsVoidType() || returnTypeSyntax.HasErrors);\n\n ImmutableArray declaredConstraints = default;\n\n if (this.Arity != 0 && (syntax.ExplicitInterfaceSpecifier != null || IsOverride))\n {\n // When a generic method overrides a generic method declared in a base class, or is an \n // explicit interface member implementation of a method in a base interface, the method\n // shall not specify any type-parameter-constraints-clauses, except for a struct, class, or default constraint.\n // In these cases, the type parameters of the method inherit constraints from the method being overridden or \n // implemented.\n if (syntax.ConstraintClauses.Count > 0)\n {\n Binder.CheckFeatureAvailability(syntax.SyntaxTree, MessageID.IDS_OverrideWithConstraints, diagnostics,\n syntax.ConstraintClauses[0].WhereKeyword.GetLocation());\n\n declaredConstraints = signatureBinder.WithAdditionalFlags(BinderFlags.GenericConstraintsClause | BinderFlags.SuppressConstraintChecks).\n BindTypeParameterConstraintClauses(this, TypeParameters, syntax.TypeParameterList, syntax.ConstraintClauses,\n diagnostics, performOnlyCycleSafeValidation: false, isForOverride: true);\n Debug.Assert(declaredConstraints.All(clause => clause.ConstraintTypes.IsEmpty));\n }\n\n // Force resolution of nullable type parameter used in the signature of an override or explicit interface implementation\n // based on constraints specified by the declaration.\n foreach (var param in parameters)\n {\n forceMethodTypeParameters(param.TypeWithAnnotations, this, declaredConstraints);\n }\n\n forceMethodTypeParameters(returnType, this, declaredConstraints);\n }\n\n return (returnType, parameters, _lazyIsVararg, declaredConstraints);\n\n static void forceMethodTypeParameters(TypeWithAnnotations type, SourceOrdinaryMethodSymbol method, ImmutableArray declaredConstraints)\n {\n type.VisitType(null, (type, args, unused2) =>\n {\n if (type.DefaultType is TypeParameterSymbol typeParameterSymbol && typeParameterSymbol.DeclaringMethod == (object)args.method)\n {\n var asValueType = args.declaredConstraints.IsDefault ||\n (args.declaredConstraints[typeParameterSymbol.Ordinal].Constraints & (TypeParameterConstraintKind.ReferenceType | TypeParameterConstraintKind.Default)) == 0;\n type.TryForceResolve(asValueType);\n }\n return false;\n }, typePredicate: null, arg: (method, declaredConstraints), canDigThroughNullable: false, useDefaultType: true);\n }\n }\n\n protected override void ExtensionMethodChecks(BindingDiagnosticBag diagnostics)\n {\n // errors relevant for extension methods\n if (IsExtensionMethod)\n {\n var syntax = GetSyntax();\n var location = locations[0];\n var parameter0Type = this.Parameters[0].TypeWithAnnotations;\n var parameter0RefKind = this.Parameters[0].RefKind;\n if (!parameter0Type.Type.IsValidExtensionParameterType())\n {\n // Duplicate Dev10 behavior by selecting the parameter type.\n var parameterSyntax = syntax.ParameterList.Parameters[0];\n Debug.Assert(parameterSyntax.Type != null);\n var loc = parameterSyntax.Type.Location;\n diagnostics.Add(ErrorCode.ERR_BadTypeforThis, loc, parameter0Type.Type);\n }\n else if (parameter0RefKind == RefKind.Ref && !parameter0Type.Type.IsValueType)\n {\n diagnostics.Add(ErrorCode.ERR_RefExtensionMustBeValueTypeOrConstrainedToOne, location, Name);\n }\n else if (parameter0RefKind == RefKind.In && parameter0Type.TypeKind != TypeKind.Struct)\n {\n diagnostics.Add(ErrorCode.ERR_InExtensionMustBeValueType, location, Name);\n }\n else if ((object)ContainingType.ContainingType != null)\n {\n diagnostics.Add(ErrorCode.ERR_ExtensionMethodsDecl, location, ContainingType.Name);\n }\n else if (!ContainingType.IsScriptClass && !(ContainingType.IsStatic && ContainingType.Arity == 0))\n {\n // Duplicate Dev10 behavior by selecting the containing type identifier. However if there\n // is no containing type (in the interactive case for instance), select the method identifier.\n var typeDecl = syntax.Parent as TypeDeclarationSyntax;\n var identifier = (typeDecl != null) ? typeDecl.Identifier : syntax.Identifier;\n var loc = identifier.GetLocation();\n diagnostics.Add(ErrorCode.ERR_BadExtensionAgg, loc);\n }\n else if (!IsStatic)\n {\n diagnostics.Add(ErrorCode.ERR_BadExtensionMeth, location);\n }\n else\n {\n // Verify ExtensionAttribute is available.\n var attributeConstructor = Binder.GetWellKnownTypeMember(DeclaringCompilation, WellKnownMember.System_Runtime_CompilerServices_ExtensionAttribute__ctor, out var useSiteInfo);\n Location thisLocation = syntax.ParameterList.Parameters[0].Modifiers.FirstOrDefault(SyntaxKind.ThisKeyword).GetLocation();\n if ((object)attributeConstructor == null)\n {\n var memberDescriptor = WellKnownMembers.GetDescriptor(WellKnownMember.System_Runtime_CompilerServices_ExtensionAttribute__ctor);\n // do not use Binder.ReportUseSiteErrorForAttributeCtor in this case, because we'll need to report a special error id, not a generic use site error.\n diagnostics.Add(\n ErrorCode.ERR_ExtensionAttrNotFound,\n thisLocation,\n memberDescriptor.DeclaringTypeMetadataName);\n }\n else\n {\n diagnostics.Add(useSiteInfo, thisLocation);\n }\n }\n }\n }\n\n protected override MethodSymbol FindExplicitlyImplementedMethod(BindingDiagnosticBag diagnostics)\n {\n var syntax = GetSyntax();\n return this.FindExplicitlyImplementedMethod(isOperator: false, _explicitInterfaceType, syntax.Identifier.ValueText, syntax.ExplicitInterfaceSpecifier, diagnostics);\n }\n\n protected override Location ReturnTypeLocation => GetSyntax().ReturnType.Location;\n\n protected override TypeSymbol ExplicitInterfaceType => _explicitInterfaceType;\n\n protected override bool HasAnyBody => _hasAnyBody;\n\n internal MethodDeclarationSyntax GetSyntax()\n {\n Debug.Assert(syntaxReferenceOpt != null);\n return (MethodDeclarationSyntax)syntaxReferenceOpt.GetSyntax();\n }\n\n protected override void CompleteAsyncMethodChecksBetweenStartAndFinish()\n {\n if (IsPartialDefinition)\n {\n DeclaringCompilation.SymbolDeclaredEvent(this);\n }\n }\n\n public override ImmutableArray> GetTypeParameterConstraintTypes()\n {\n if (_lazyTypeParameterConstraintTypes.IsDefault)\n {\n GetTypeParameterConstraintKinds();\n\n var diagnostics = BindingDiagnosticBag.GetInstance();\n var syntax = GetSyntax();\n var withTypeParametersBinder =\n this.DeclaringCompilation\n .GetBinderFactory(syntax.SyntaxTree)\n .GetBinder(syntax.ReturnType, syntax, this);\n var constraints = this.MakeTypeParameterConstraintTypes(\n withTypeParametersBinder,\n TypeParameters,\n syntax.TypeParameterList,\n syntax.ConstraintClauses,\n diagnostics);\n if (ImmutableInterlocked.InterlockedInitialize(ref _lazyTypeParameterConstraintTypes, constraints))\n {\n this.AddDeclarationDiagnostics(diagnostics);\n }\n diagnostics.Free();\n }\n\n return _lazyTypeParameterConstraintTypes;\n }\n\n public override ImmutableArray GetTypeParameterConstraintKinds()\n {\n if (_lazyTypeParameterConstraintKinds.IsDefault)\n {\n var syntax = GetSyntax();\n var withTypeParametersBinder =\n this.DeclaringCompilation\n .GetBinderFactory(syntax.SyntaxTree)\n .GetBinder(syntax.ReturnType, syntax, this);\n var constraints = this.MakeTypeParameterConstraintKinds(\n withTypeParametersBinder,\n TypeParameters,\n syntax.TypeParameterList,\n syntax.ConstraintClauses);\n\n ImmutableInterlocked.InterlockedInitialize(ref _lazyTypeParameterConstraintKinds, constraints);\n }\n\n return _lazyTypeParameterConstraintKinds;\n }\n\n public override bool IsVararg\n {\n get\n {\n LazyMethodChecks();\n return _lazyIsVararg;\n }\n }\n\n protected override int GetParameterCountFromSyntax() => GetSyntax().ParameterList.ParameterCount;\n\n public override RefKind RefKind\n {\n get\n {\n return _refKind;\n }\n }\n\n internal static void InitializePartialMethodParts(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation)\n {\n Debug.Assert(definition.IsPartialDefinition);\n Debug.Assert(implementation.IsPartialImplementation);\n Debug.Assert((object)definition._otherPartOfPartial == null || (object)definition._otherPartOfPartial == implementation);\n Debug.Assert((object)implementation._otherPartOfPartial == null || (object)implementation._otherPartOfPartial == definition);\n\n definition._otherPartOfPartial = implementation;\n implementation._otherPartOfPartial = definition;\n }\n\n /// \n /// If this is a partial implementation part returns the definition part and vice versa.\n /// \n internal SourceOrdinaryMethodSymbol OtherPartOfPartial\n {\n get { return _otherPartOfPartial; }\n }\n\n /// \n /// Returns true if this symbol represents a partial method definition (the part that specifies a signature but no body).\n /// \n internal bool IsPartialDefinition\n {\n get\n {\n return this.IsPartial && !_hasAnyBody && !HasExternModifier;\n }\n }\n\n /// \n /// Returns true if this symbol represents a partial method implementation (the part that specifies both signature and body).\n /// \n internal bool IsPartialImplementation\n {\n get\n {\n return this.IsPartial && (_hasAnyBody || HasExternModifier);\n }\n }\n\n /// \n /// True if this is a partial method that doesn't have an implementation part.\n /// \n internal bool IsPartialWithoutImplementation\n {\n get\n {\n return this.IsPartialDefinition && (object)_otherPartOfPartial == null;\n }\n }\n\n /// \n /// Returns the implementation part of a partial method definition, \n /// or null if this is not a partial method or it is the definition part.\n /// \n internal SourceOrdinaryMethodSymbol SourcePartialDefinition\n {\n get\n {\n return this.IsPartialImplementation ? _otherPartOfPartial : null;\n }\n }\n\n /// \n /// Returns the definition part of a partial method implementation, \n /// or null if this is not a partial method or it is the implementation part.\n /// \n internal SourceOrdinaryMethodSymbol SourcePartialImplementation\n {\n get\n {\n return this.IsPartialDefinition ? _otherPartOfPartial : null;\n }\n }\n\n public override MethodSymbol PartialDefinitionPart\n {\n get\n {\n return SourcePartialDefinition;\n }\n }\n\n public override MethodSymbol PartialImplementationPart\n {\n get\n {\n return SourcePartialImplementation;\n }\n }\n\n public sealed override bool IsExtern\n {\n get\n {\n return IsPartialDefinition\n ? _otherPartOfPartial?.IsExtern ?? false\n : HasExternModifier;\n }\n }\n\n public override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default(CancellationToken))\n {\n ref var lazyDocComment = ref expandIncludes ? ref this.lazyExpandedDocComment : ref this.lazyDocComment;\n return SourceDocumentationCommentUtils.GetAndCacheDocumentationComment(this, expandIncludes, ref lazyDocComment);\n }\n\n protected override SourceMemberMethodSymbol BoundAttributesSource\n {\n get\n {\n return this.SourcePartialDefinition;\n }\n }\n\n internal override OneOrMany> GetAttributeDeclarations()\n {\n if ((object)this.SourcePartialImplementation != null)\n {\n return OneOrMany.Create(ImmutableArray.Create(AttributeDeclarationSyntaxList, this.SourcePartialImplementation.AttributeDeclarationSyntaxList));\n }\n else\n {\n return OneOrMany.Create(AttributeDeclarationSyntaxList);\n }\n }\n\n private SyntaxList AttributeDeclarationSyntaxList\n {\n get\n {\n var sourceContainer = this.ContainingType as SourceMemberContainerTypeSymbol;\n if ((object)sourceContainer != null && sourceContainer.AnyMemberHasAttributes)\n {\n return this.GetSyntax().AttributeLists;\n }\n\n return default(SyntaxList);\n }\n }\n\n internal override bool IsExpressionBodied\n {\n get { return _isExpressionBodied; }\n }\n\n protected override DeclarationModifiers MakeDeclarationModifiers(DeclarationModifiers allowedModifiers, BindingDiagnosticBag diagnostics)\n {\n var syntax = GetSyntax();\n return ModifierUtils.MakeAndCheckNontypeMemberModifiers(syntax.Modifiers, defaultAccess: DeclarationModifiers.None, allowedModifiers, Locations[0], diagnostics, out _);\n }\n\n private ImmutableArray MakeTypeParameters(MethodDeclarationSyntax syntax, BindingDiagnosticBag diagnostics)\n {\n Debug.Assert(syntax.TypeParameterList != null);\n\n OverriddenMethodTypeParameterMapBase typeMap = null;\n if (this.IsOverride)\n {\n typeMap = new OverriddenMethodTypeParameterMap(this);\n }\n else if (this.IsExplicitInterfaceImplementation)\n {\n typeMap = new ExplicitInterfaceMethodTypeParameterMap(this);\n }\n\n var typeParameters = syntax.TypeParameterList.Parameters;\n var result = ArrayBuilder.GetInstance();\n\n for (int ordinal = 0; ordinal < typeParameters.Count; ordinal++)\n {\n var parameter = typeParameters[ordinal];\n if (parameter.VarianceKeyword.Kind() != SyntaxKind.None)\n {\n diagnostics.Add(ErrorCode.ERR_IllegalVarianceSyntax, parameter.VarianceKeyword.GetLocation());\n }\n\n var identifier = parameter.Identifier;\n var location = identifier.GetLocation();\n var name = identifier.ValueText;\n\n // Note: It is not an error to have a type parameter named the same as its enclosing method: void M() {}\n\n for (int i = 0; i < result.Count; i++)\n {\n if (name == result[i].Name)\n {\n diagnostics.Add(ErrorCode.ERR_DuplicateTypeParameter, location, name);\n break;\n }\n }\n\n SourceMemberContainerTypeSymbol.ReportTypeNamedRecord(identifier.Text, this.DeclaringCompilation, diagnostics.DiagnosticBag, location);\n\n var tpEnclosing = ContainingType.FindEnclosingTypeParameter(name);\n if ((object)tpEnclosing != null)\n {\n // Type parameter '{0}' has the same name as the type parameter from outer type '{1}'\n diagnostics.Add(ErrorCode.WRN_TypeParameterSameAsOuterTypeParameter, location, name, tpEnclosing.ContainingType);\n }\n\n var syntaxRefs = ImmutableArray.Create(parameter.GetReference());\n var locations = ImmutableArray.Create(location);\n var typeParameter = (typeMap != null) ?\n (TypeParameterSymbol)new SourceOverridingMethodTypeParameterSymbol(\n typeMap,\n name,\n ordinal,\n locations,\n syntaxRefs) :\n new SourceMethodTypeParameterSymbol(\n this,\n name,\n ordinal,\n locations,\n syntaxRefs);\n\n result.Add(typeParameter);\n }\n\n return result.ToImmutableAndFree();\n }\n\n internal override void ForceComplete(SourceLocation locationOpt, CancellationToken cancellationToken)\n {\n var implementingPart = this.SourcePartialImplementation;\n if ((object)implementingPart != null)\n {\n implementingPart.ForceComplete(locationOpt, cancellationToken);\n }\n\n base.ForceComplete(locationOpt, cancellationToken);\n }\n\n internal override bool IsDefinedInSourceTree(\n SyntaxTree tree,\n TextSpan? definedWithinSpan,\n CancellationToken cancellationToken = default(CancellationToken))\n {\n // Since only the declaring (and not the implementing) part of a partial method appears in the member\n // list, we need to ensure we complete the implementation part when needed.\n return\n base.IsDefinedInSourceTree(tree, definedWithinSpan, cancellationToken) ||\n this.SourcePartialImplementation?.IsDefinedInSourceTree(tree, definedWithinSpan, cancellationToken) == true;\n }\n\n protected override void CheckConstraintsForExplicitInterfaceType(ConversionsBase conversions, BindingDiagnosticBag diagnostics)\n {\n if ((object)_explicitInterfaceType != null)\n {\n var syntax = this.GetSyntax();\n Debug.Assert(syntax.ExplicitInterfaceSpecifier != null);\n _explicitInterfaceType.CheckAllConstraints(DeclaringCompilation, conversions, new SourceLocation(syntax.ExplicitInterfaceSpecifier.Name), diagnostics);\n }\n }\n\n protected override void PartialMethodChecks(BindingDiagnosticBag diagnostics)\n {\n var implementingPart = this.SourcePartialImplementation;\n if ((object)implementingPart != null)\n {\n PartialMethodChecks(this, implementingPart, diagnostics);\n }\n }\n\n /// \n /// Report differences between the defining and implementing\n /// parts of a partial method. Diagnostics are reported on the\n /// implementing part, matching Dev10 behavior.\n /// \n private static void PartialMethodChecks(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation, BindingDiagnosticBag diagnostics)\n {\n Debug.Assert(!ReferenceEquals(definition, implementation));\n\n MethodSymbol constructedDefinition = definition.ConstructIfGeneric(TypeMap.TypeParametersAsTypeSymbolsWithIgnoredAnnotations(implementation.TypeParameters));\n bool hasTypeDifferences = !constructedDefinition.ReturnTypeWithAnnotations.Equals(implementation.ReturnTypeWithAnnotations, TypeCompareKind.AllIgnoreOptions);\n if (hasTypeDifferences)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodReturnTypeDifference, implementation.Locations[0]);\n }\n else if (MemberSignatureComparer.ConsideringTupleNamesCreatesDifference(definition, implementation))\n {\n hasTypeDifferences = true;\n diagnostics.Add(ErrorCode.ERR_PartialMethodInconsistentTupleNames, implementation.Locations[0], definition, implementation);\n }\n\n if (definition.RefKind != implementation.RefKind)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodRefReturnDifference, implementation.Locations[0]);\n }\n\n if (definition.IsStatic != implementation.IsStatic)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodStaticDifference, implementation.Locations[0]);\n }\n\n if (definition.IsDeclaredReadOnly != implementation.IsDeclaredReadOnly)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodReadOnlyDifference, implementation.Locations[0]);\n }\n\n if (definition.IsExtensionMethod != implementation.IsExtensionMethod)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodExtensionDifference, implementation.Locations[0]);\n }\n\n if (definition.IsUnsafe != implementation.IsUnsafe && definition.CompilationAllowsUnsafe()) // Don't cascade.\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodUnsafeDifference, implementation.Locations[0]);\n }\n\n if (definition.IsParams() != implementation.IsParams())\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodParamsDifference, implementation.Locations[0]);\n }\n\n if (definition.HasExplicitAccessModifier != implementation.HasExplicitAccessModifier\n || definition.DeclaredAccessibility != implementation.DeclaredAccessibility)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodAccessibilityDifference, implementation.Locations[0]);\n }\n\n if (definition.IsVirtual != implementation.IsVirtual\n || definition.IsOverride != implementation.IsOverride\n || definition.IsSealed != implementation.IsSealed\n || definition.IsNew != implementation.IsNew)\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodExtendedModDifference, implementation.Locations[0]);\n }\n\n PartialMethodConstraintsChecks(definition, implementation, diagnostics);\n\n if (SourceMemberContainerTypeSymbol.CheckValidNullableMethodOverride(\n implementation.DeclaringCompilation,\n constructedDefinition,\n implementation,\n diagnostics,\n static (diagnostics, implementedMethod, implementingMethod, topLevel, arg) =>\n {\n // report only if this is an unsafe *nullability* difference\n diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnPartial, implementingMethod.Locations[0]);\n },\n static (diagnostics, implementedMethod, implementingMethod, implementingParameter, blameAttributes, arg) =>\n {\n diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnPartial, implementingMethod.Locations[0], new FormattedSymbol(implementingParameter, SymbolDisplayFormat.ShortFormat));\n },\n extraArgument: (object)null))\n {\n hasTypeDifferences = true;\n }\n\n if ((!hasTypeDifferences && !MemberSignatureComparer.PartialMethodsStrictComparer.Equals(definition, implementation)) ||\n hasDifferencesInParameterOrTypeParameterName(definition, implementation))\n {\n diagnostics.Add(ErrorCode.WRN_PartialMethodTypeDifference, implementation.Locations[0],\n new FormattedSymbol(definition, SymbolDisplayFormat.MinimallyQualifiedFormat),\n new FormattedSymbol(implementation, SymbolDisplayFormat.MinimallyQualifiedFormat));\n }\n\n static bool hasDifferencesInParameterOrTypeParameterName(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation)\n {\n return !definition.Parameters.SequenceEqual(implementation.Parameters, (a, b) => a.Name == b.Name) ||\n !definition.TypeParameters.SequenceEqual(implementation.TypeParameters, (a, b) => a.Name == b.Name);\n }\n }\n\n private static void PartialMethodConstraintsChecks(SourceOrdinaryMethodSymbol definition, SourceOrdinaryMethodSymbol implementation, BindingDiagnosticBag diagnostics)\n {\n Debug.Assert(!ReferenceEquals(definition, implementation));\n Debug.Assert(definition.Arity == implementation.Arity);\n\n var typeParameters1 = definition.TypeParameters;\n\n int arity = typeParameters1.Length;\n if (arity == 0)\n {\n return;\n }\n\n var typeParameters2 = implementation.TypeParameters;\n var indexedTypeParameters = IndexedTypeParameterSymbol.Take(arity);\n var typeMap1 = new TypeMap(typeParameters1, indexedTypeParameters, allowAlpha: true);\n var typeMap2 = new TypeMap(typeParameters2, indexedTypeParameters, allowAlpha: true);\n\n // Report any mismatched method constraints.\n for (int i = 0; i < arity; i++)\n {\n var typeParameter1 = typeParameters1[i];\n var typeParameter2 = typeParameters2[i];\n\n if (!MemberSignatureComparer.HaveSameConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2))\n {\n diagnostics.Add(ErrorCode.ERR_PartialMethodInconsistentConstraints, implementation.Locations[0], implementation, typeParameter2.Name);\n }\n else if (!MemberSignatureComparer.HaveSameNullabilityInConstraints(typeParameter1, typeMap1, typeParameter2, typeMap2))\n {\n diagnostics.Add(ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation, implementation.Locations[0], implementation, typeParameter2.Name);\n }\n }\n }\n\n internal override bool CallsAreOmitted(SyntaxTree syntaxTree)\n {\n if (this.IsPartialWithoutImplementation)\n {\n return true;\n }\n\n return base.CallsAreOmitted(syntaxTree);\n }\n\n internal override bool GenerateDebugInfo => !IsAsync && !IsIterator;\n }\n}\n"},"label":{"kind":"number","value":1,"string":"1"}}},{"rowIdx":836,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56419,"string":"56,419"},"pr_title":{"kind":"string","value":"Fix partial method doc comments"},"pr_description":{"kind":"string","value":"Fixes #54103.\r\n\r\nThe specific rule changes implemented in this PR are laid out in dotnet/csharplang#5193.\r\n\r\nHave added tests to ensure that the expected documentation is shown in Quick Info."},"author":{"kind":"string","value":"RikkiGibson"},"date_created":{"kind":"timestamp","value":"2021-09-15T20:47:39Z","string":"2021-09-15T20:47:39Z"},"date_merged":{"kind":"timestamp","value":"2021-09-21T23:49:10Z","string":"2021-09-21T23:49:10Z"},"previous_commit":{"kind":"string","value":"0f60b3e9446f5d0fc14a570998c81a5d6c40cc23"},"pr_commit":{"kind":"string","value":"8cda7462843d43d9b72039eede2f4cb43126cac2"},"query":{"kind":"string","value":"Fix partial method doc comments. Fixes #54103.\r\n\r\nThe specific rule changes implemented in this PR are laid out in dotnet/csharplang#5193.\r\n\r\nHave added tests to ensure that the expected documentation is shown in Quick Info."},"filepath":{"kind":"string","value":"./src/Compilers/CSharp/Test/Symbol/DocumentationComments/DocumentationCommentCompilerTests.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing System.Xml;\nusing System.Xml.Linq;\nusing Microsoft.CodeAnalysis.CSharp.Symbols;\nusing Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE;\nusing Microsoft.CodeAnalysis.CSharp.Test.Utilities;\nusing Microsoft.CodeAnalysis.Test.Utilities;\nusing Roslyn.Test.Utilities;\nusing Roslyn.Utilities;\nusing Xunit;\n\nnamespace Microsoft.CodeAnalysis.CSharp.UnitTests\n{\n public class DocumentationCommentCompilerTests : CSharpTestBase\n {\n public static CSharpCompilation CreateCompilationUtil(\n CSharpTestSource source,\n IEnumerable references = null,\n CSharpCompilationOptions options = null,\n string assemblyName = \"Test\") =>\n CreateCompilation(\n source,\n references,\n targetFramework: TargetFramework.Mscorlib40,\n options: (options ?? TestOptions.ReleaseDll).WithXmlReferenceResolver(XmlFileResolver.Default),\n parseOptions: TestOptions.RegularWithDocumentationComments,\n assemblyName: assemblyName);\n\n #region Single-line styleWRN_UnqualifiedNestedTypeInCref\n\n [Fact]\n public void SingleLine_OneLine()\n {\n var source = @\"\n/// Text\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n Text\n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void SingleLine_MultipleLines()\n {\n var source = @\"\n/// \n/// Text\n/// \npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n Text\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void SingleLine_EmptyOneLine()\n {\n var source = @\"\n///\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void SingleLine_EmptyMultipleLines()\n {\n var source = @\"\n///\n///\n///\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n \n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void SingleLine_NoLeadingSpaces()\n {\n var source = @\"\n///\n///Text\n///\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n Text\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void SingleLine_SomeLeadingSpaces()\n {\n var source = @\"\n///\n/// Text\n/// \npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n Text\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void SingleLine_LeadingTab()\n {\n var source = @\"\n/// \n///\tTabbed\n/// \npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n Tabbed\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void SingleLine_WhitespaceBefore()\n {\n var source = @\"\n/// \n /// Text\n /// \npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n Text\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void SingleLine_BlankLines()\n {\n var source = @\"\n/// \n/// \n/// Text\n/// \n/// \npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n \n Text\n \n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n #endregion Single-line style\n\n #region Multi-line style\n\n [Fact]\n public void MultiLine_OneLine()\n {\n var source = @\"\n/** Text */\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n Text \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void MultiLine_EmptyOneLine()\n {\n var source = @\"\n/** */\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void MultiLine_EmptyTwoLines()\n {\n var source = @\"\n/**\n */\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void MultiLine_EmptyThreeLines()\n {\n var source = @\"\n/**\n\n */\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void MultiLine_FirstLineSpace()\n {\n var source = @\"\n/** \n * Text\n * \n */\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n Text\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void MultiLine_FirstLineNoSpace()\n {\n var source = @\"\n/**\n * Text\n * \n */\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n Text\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void MultiLine_StarsPattern()\n {\n var source = @\"\n/**\n * \n * Text\n * \n */\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n Text\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void MultiLine_StarsNoPattern()\n {\n var source = @\"\n/**\n * \n * Text\n * \n */\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n * \n * Text\n * \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void MultiLine_WhitespacePattern()\n {\n var source = @\"\n/**\n \n Text\n \n */\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n Text\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void MultiLine_WhitespaceNoPattern()\n {\n var source = @\"\n/**\n \n Text\n \n */\npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n Text\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void MultiLine_LegacyTests()\n {\n var source = @\"\nclass A\n{\n\t/**\n\t\t\t* \n\t\t\t*\t/** \n\t\t\t*\t\n\t\t\t*\t\n\t\t\t* \n\t\t\t*/\n\tpublic void foo1(){}\n\n\t/**\n\t* ///\n\t*\t\t///\n\t* /**\n\t*/\n\tpublic void foo2(){}\n\n\t/**\n\t/// \n\t///\n\t/// \n\t*/\n\tpublic void foo3(){}\n\n\t// Test: // should not be xml comment\n\t/**\n\t// \n\t// \n\t// \n\t*/\n\tpublic void foo4(){}\n}\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n \t/** \n \t\n \t\n \n \n \n ///\n \t\t///\n /**\n \n \n \t/// \n \t///\n \t/// \n \n \n \t// \n \t// \n \t// \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [WorkItem(547164, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547164\")]\n [Fact]\n public void MultiLine_PatternShorterOnSubsequentLine()\n {\n var source = @\"\n//repro.cs\npublic class Point\n{\n /**\n * Instance variable in the \n * Point Class.\n */\n private int x;\n \n /**\n * This is the entry point of the Point class testing\n * program.\n */\n public static void Main()\n {\n }\n}\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp,\n // (3,14): warning CS1591: Missing XML comment for publicly visible type or member 'Point'\n // public class Point\n Diagnostic(ErrorCode.WRN_MissingXMLComment, \"Point\").WithArguments(\"Point\"));\n var expected = @\"\n\n\n \n Test\n \n \n \n Instance variable in the \n Point Class.\n \n \n This is the entry point of the Point class testing\n program.\n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n #endregion Multi-line style\n\n #region Partial types\n\n [Fact]\n public void PartialTypes_OneFile()\n {\n var source = @\"\n/// Summary 1\npublic partial class C { }\n\n/// Summary 2\npublic partial class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n Summary 1\n Summary 2\n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void PartialTypes_MultipleFiles()\n {\n var source1 = @\"\n/// Summary 1\npublic partial class C { }\n\";\n\n var source2 = @\"\n/// Summary 2\npublic partial class C { }\n\";\n\n var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments);\n var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments);\n\n // Files passed in order.\n var compA = CreateCompilation(new[] { tree1, tree2 }, assemblyName: \"Test\");\n var actualA = GetDocumentationCommentText(compA);\n var expectedA = @\"\n\n\n \n Test\n \n \n \n Summary 1\n Summary 2\n \n \n\n\".Trim();\n Assert.Equal(expectedA, actualA);\n\n // Files passed in reverse order.\n var compB = CreateCompilation(new[] { tree2, tree1 }, assemblyName: \"Test\");\n var actualB = GetDocumentationCommentText(compB);\n var expectedB = @\"\n\n\n \n Test\n \n \n \n Summary 2\n Summary 1\n \n \n\n\".Trim();\n Assert.Equal(expectedB, actualB);\n }\n\n [Fact]\n public void PartialTypes_MultipleStyles()\n {\n var source = @\"\n/// Summary 1\npublic partial class C { }\n\n/** Summary 2 */\npublic partial class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n Summary 1\n Summary 2 \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n #endregion Partial types\n\n #region Partial methods\n\n [Fact]\n public void PartialMethods_OneFile()\n {\n var source = @\"\npartial class C\n{\n /// Summary 1\n partial void M();\n}\n\npartial class C\n{\n /// Summary 2\n partial void M() { }\n}\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n Summary 2\n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void PartialMethods_MultipleFiles()\n {\n var source1 = @\"\npartial class C\n{\n /** Summary 1*/\n partial void M() { }\n}\n\";\n\n var source2 = @\"\npartial class C\n{\n /** Summary 2*/\n partial void M();\n}\n\";\n\n var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments);\n var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments);\n\n // Files passed in order.\n var compA = CreateCompilation(new[] { tree1, tree2 }, assemblyName: \"Test\");\n var actualA = GetDocumentationCommentText(compA);\n var expectedA = @\"\n\n\n \n Test\n \n \n \n Summary 1\n \n \n\n\".Trim();\n Assert.Equal(expectedA, actualA);\n\n // Files passed in reverse order.\n var compB = CreateCompilation(new[] { tree2, tree1 }, assemblyName: \"Test\");\n var actualB = GetDocumentationCommentText(compB);\n var expectedB = @\"\n\n\n \n Test\n \n \n \n Summary 1\n \n \n\n\".Trim();\n Assert.Equal(expectedB, actualB);\n }\n\n [Fact]\n public void ExtendedPartialMethods_MultipleFiles()\n {\n var source1 = @\"\npartial class C\n{\n /** Summary 1*/\n public partial int M() => 42;\n}\n\";\n\n var source2 = @\"\npartial class C\n{\n /** Summary 2*/\n public partial int M();\n}\n\";\n\n var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments);\n var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments);\n\n // Files passed in order.\n var compA = CreateCompilation(new[] { tree1, tree2 }, assemblyName: \"Test\");\n var actualA = GetDocumentationCommentText(compA);\n var expectedA = @\"\n\n\n \n Test\n \n \n \n Summary 1\n \n \n\n\".Trim();\n Assert.Equal(expectedA, actualA);\n\n // Files passed in reverse order.\n var compB = CreateCompilation(new[] { tree2, tree1 }, assemblyName: \"Test\");\n var actualB = GetDocumentationCommentText(compB);\n var expectedB = @\"\n\n\n \n Test\n \n \n \n Summary 1\n \n \n\n\".Trim();\n Assert.Equal(expectedB, actualB);\n }\n\n #endregion Partial methods\n\n #region Crefs\n\n [Fact]\n public void ValidCrefs()\n {\n var source = @\"\n/// \n/// A B \n/// C.\n/// \npublic class C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n Test\n \n \n \n \n A B \n C.\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void InvalidCrefs()\n {\n var source = @\"\n/// \n/// A .\n/// \npublic class C { }\n\n/// \n/// A .\n/// \npublic class D { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp,\n // (3,18): warning CS1574: XML comment has cref attribute 'Q' that could not be resolved\n // /// A .\n Diagnostic(ErrorCode.WRN_BadXMLRef, \"Q\").WithArguments(\"Q\"),\n // (8,18): warning CS1574: XML comment has cref attribute 'R{S, T}' that could not be resolved\n // /// A .\n Diagnostic(ErrorCode.WRN_BadXMLRef, \"R{S, T}\").WithArguments(\"R{S, T}\"));\n var expected = @\"\n\n\n \n Test\n \n \n \n \n A .\n \n \n \n \n A .\n \n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n #endregion Crefs\n\n #region Output name\n\n [Fact]\n public void AssemblyNameFromCompilationName()\n {\n var source = @\"\n/// A .\npublic class C\n{\n static void Main() {}\n}\n\";\n var comp = CreateCompilationUtil(source, assemblyName: \"CompilationName\");\n var actual = GetDocumentationCommentText(comp);\n var expected = @\"\n\n\n \n CompilationName\n \n \n \n A .\n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void AssemblyNameFromOutputName()\n {\n var source = @\"\n/// A .\npublic class C\n{\n static void Main() {}\n}\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp, \"OutputName\");\n var expected = @\"\n\n\n \n OutputName\n \n \n \n A .\n \n \n\n\".Trim();\n Assert.Equal(expected, actual);\n }\n\n #endregion Output name\n\n #region WRN_UnprocessedXMLComment\n\n [Fact]\n public void UnprocessedXMLComment_Types()\n {\n var source = @\"\nclass C : object where T : I\n{\n \n}\n\nstruct S where T : U\n{\n\n}\n\ninterface I\n{\n\n}\n\ndelegate void D(T t, U u) where T : U;\n\nenum E : byte\n{\n\n}\n\";\n\n var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).GetCompilationUnitRoot()).ToFullString();\n // Manually verified that positions match dev11.\n CreateCompilationUtil(revisedSource).VerifyDiagnostics(\n // (2,15): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C/** 2 */** 3 */T/** 4 */> /** 5 */: /** 6 */object /** 7 */where /** 8 */T /** 9 */: /** 10 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (2,24): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C/** 2 */** 3 */T/** 4 */> /** 5 */: /** 6 */object /** 7 */where /** 8 */T /** 9 */: /** 10 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (2,33): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C/** 2 */** 3 */T/** 4 */> /** 5 */: /** 6 */object /** 7 */where /** 8 */T /** 9 */: /** 10 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (2,42): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C/** 2 */** 3 */T/** 4 */> /** 5 */: /** 6 */object /** 7 */where /** 8 */T /** 9 */: /** 10 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (2,52): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C/** 2 */** 3 */T/** 4 */> /** 5 */: /** 6 */object /** 7 */where /** 8 */T /** 9 */: /** 10 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (2,62): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C/** 2 */** 3 */T/** 4 */> /** 5 */: /** 6 */object /** 7 */where /** 8 */T /** 9 */: /** 10 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (2,77): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C/** 2 */** 3 */T/** 4 */> /** 5 */: /** 6 */object /** 7 */where /** 8 */T /** 9 */: /** 10 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (2,91): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C/** 2 */** 3 */T/** 4 */> /** 5 */: /** 6 */object /** 7 */where /** 8 */T /** 9 */: /** 10 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (2,101): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C/** 2 */** 3 */T/** 4 */> /** 5 */: /** 6 */object /** 7 */where /** 8 */T /** 9 */: /** 10 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (2,111): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C/** 2 */** 3 */T/** 4 */> /** 5 */: /** 6 */object /** 7 */where /** 8 */T /** 9 */: /** 10 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (3,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 11 */{\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 12 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,17): warning CS1587: XML comment is not placed on a valid language element\n // /** 13 */struct /** 14 */S/** 15 */** 16 */T/** 17 */, /** 18 */U/** 19 */> /** 20 */where /** 21 */T /** 22 */: /** 23 */U\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,27): warning CS1587: XML comment is not placed on a valid language element\n // /** 13 */struct /** 14 */S/** 15 */** 16 */T/** 17 */, /** 18 */U/** 19 */> /** 20 */where /** 21 */T /** 22 */: /** 23 */U\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,37): warning CS1587: XML comment is not placed on a valid language element\n // /** 13 */struct /** 14 */S/** 15 */** 16 */T/** 17 */, /** 18 */U/** 19 */> /** 20 */where /** 21 */T /** 22 */: /** 23 */U\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,47): warning CS1587: XML comment is not placed on a valid language element\n // /** 13 */struct /** 14 */S/** 15 */** 16 */T/** 17 */, /** 18 */U/** 19 */> /** 20 */where /** 21 */T /** 22 */: /** 23 */U\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,58): warning CS1587: XML comment is not placed on a valid language element\n // /** 13 */struct /** 14 */S/** 15 */** 16 */T/** 17 */, /** 18 */U/** 19 */> /** 20 */where /** 21 */T /** 22 */: /** 23 */U\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,68): warning CS1587: XML comment is not placed on a valid language element\n // /** 13 */struct /** 14 */S/** 15 */** 16 */T/** 17 */, /** 18 */U/** 19 */> /** 20 */where /** 21 */T /** 22 */: /** 23 */U\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,79): warning CS1587: XML comment is not placed on a valid language element\n // /** 13 */struct /** 14 */S/** 15 */** 16 */T/** 17 */, /** 18 */U/** 19 */> /** 20 */where /** 21 */T /** 22 */: /** 23 */U\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,94): warning CS1587: XML comment is not placed on a valid language element\n // /** 13 */struct /** 14 */S/** 15 */** 16 */T/** 17 */, /** 18 */U/** 19 */> /** 20 */where /** 21 */T /** 22 */: /** 23 */U\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,105): warning CS1587: XML comment is not placed on a valid language element\n // /** 13 */struct /** 14 */S/** 15 */** 16 */T/** 17 */, /** 18 */U/** 19 */> /** 20 */where /** 21 */T /** 22 */: /** 23 */U\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,116): warning CS1587: XML comment is not placed on a valid language element\n // /** 13 */struct /** 14 */S/** 15 */** 16 */T/** 17 */, /** 18 */U/** 19 */> /** 20 */where /** 21 */T /** 22 */: /** 23 */U\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */{\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 25 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,20): warning CS1587: XML comment is not placed on a valid language element\n // /** 26 */interface /** 27 */I\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (13,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 28 */{\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (15,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 29 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,19): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,33): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,43): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,53): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,63): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,74): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,84): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,94): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,104): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,115): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,125): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,136): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,147): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,157): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,168): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,183): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,194): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,205): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,215): warning CS1587: XML comment is not placed on a valid language element\n // /** 30 */delegate /** 31 */void /** 32 */D/** 33 */** 34 */T/** 35 */, /** 36 */U/** 37 */>/** 38 */(/** 39 */T /** 40 */t/** 41 */, /** 42 */U /** 43 */u/** 44 */) /** 45 */where /** 46 */T /** 47 */: /** 48 */U/** 49 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (19,15): warning CS1587: XML comment is not placed on a valid language element\n // /** 50 */enum /** 51 */E /** 52 */: /** 53 */byte\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (19,26): warning CS1587: XML comment is not placed on a valid language element\n // /** 50 */enum /** 51 */E /** 52 */: /** 53 */byte\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (19,37): warning CS1587: XML comment is not placed on a valid language element\n // /** 50 */enum /** 51 */E /** 52 */: /** 53 */byte\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (20,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 54 */{\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (22,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (23,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 56 */\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"));\n }\n\n [Fact]\n public void UnprocessedXMLComment_Members()\n {\n var source = @\"\nclass C\n{\n private int field;\n private int Property { get; set; }\n private int this[int x] { get { return 0; } set { } }\n private event System.Action FieldLikeEvent;\n private event System.Action CustomEvent { add { } remove { } }\n private void Method(T t, U u) where T : U { }\n public static int operator +(C c) { return 0; }\n public static explicit operator int(C c) { return 0; }\n private C(int x) : base() { }\n}\n\nenum E\n{\n A,\n}\n\";\n\n var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).GetCompilationUnitRoot()).ToFullString();\n // Manually verified that positions match dev11.\n CreateCompilationUtil(revisedSource).VerifyDiagnostics(\n // (4,41): warning CS0169: The field 'C.field' is never used\n // /** 3 */private /** 4 */int /** 5 */field/** 6 */;\n Diagnostic(ErrorCode.WRN_UnreferencedField, \"field\").WithArguments(\"C.field\"),\n // (7,87): warning CS0067: The event 'C.FieldLikeEvent' is never used\n // /** 34 */private /** 35 */event /** 36 */System/** 37 */./** 38 */Action /** 39 */FieldLikeEvent/** 40 */;\n Diagnostic(ErrorCode.WRN_UnreferencedEvent, \"FieldLikeEvent\").WithArguments(\"C.FieldLikeEvent\"),\n\n // (2,15): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (3,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 2 */{\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (4,21): warning CS1587: XML comment is not placed on a valid language element\n // /** 3 */private /** 4 */int /** 5 */field/** 6 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (4,33): warning CS1587: XML comment is not placed on a valid language element\n // /** 3 */private /** 4 */int /** 5 */field/** 6 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (4,46): warning CS1587: XML comment is not placed on a valid language element\n // /** 3 */private /** 4 */int /** 5 */field/** 6 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,21): warning CS1587: XML comment is not placed on a valid language element\n // /** 7 */private /** 8 */int /** 9 */Property /** 10 */{ /** 11 */get/** 12 */; /** 13 */set/** 14 */; /** 15 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,33): warning CS1587: XML comment is not placed on a valid language element\n // /** 7 */private /** 8 */int /** 9 */Property /** 10 */{ /** 11 */get/** 12 */; /** 13 */set/** 14 */; /** 15 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,50): warning CS1587: XML comment is not placed on a valid language element\n // /** 7 */private /** 8 */int /** 9 */Property /** 10 */{ /** 11 */get/** 12 */; /** 13 */set/** 14 */; /** 15 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,61): warning CS1587: XML comment is not placed on a valid language element\n // /** 7 */private /** 8 */int /** 9 */Property /** 10 */{ /** 11 */get/** 12 */; /** 13 */set/** 14 */; /** 15 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,73): warning CS1587: XML comment is not placed on a valid language element\n // /** 7 */private /** 8 */int /** 9 */Property /** 10 */{ /** 11 */get/** 12 */; /** 13 */set/** 14 */; /** 15 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,84): warning CS1587: XML comment is not placed on a valid language element\n // /** 7 */private /** 8 */int /** 9 */Property /** 10 */{ /** 11 */get/** 12 */; /** 13 */set/** 14 */; /** 15 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,96): warning CS1587: XML comment is not placed on a valid language element\n // /** 7 */private /** 8 */int /** 9 */Property /** 10 */{ /** 11 */get/** 12 */; /** 13 */set/** 14 */; /** 15 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,107): warning CS1587: XML comment is not placed on a valid language element\n // /** 7 */private /** 8 */int /** 9 */Property /** 10 */{ /** 11 */get/** 12 */; /** 13 */set/** 14 */; /** 15 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,22): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,35): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,48): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,58): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,71): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,81): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,92): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,103): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,116): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,127): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,143): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,153): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,164): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,175): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,188): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,199): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,210): warning CS1587: XML comment is not placed on a valid language element\n // /** 16 */private /** 17 */int /** 18 */this/** 19 */[/** 20 */int /** 21 */x/** 22 */] /** 23 */{ /** 24 */get /** 25 */{ /** 26 */return /** 27 */0/** 28 */; /** 29 */} /** 30 */set /** 31 */{ /** 32 */} /** 33 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,22): warning CS1587: XML comment is not placed on a valid language element\n // /** 34 */private /** 35 */event /** 36 */System/** 37 */./** 38 */Action /** 39 */FieldLikeEvent/** 40 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,37): warning CS1587: XML comment is not placed on a valid language element\n // /** 34 */private /** 35 */event /** 36 */System/** 37 */./** 38 */Action /** 39 */FieldLikeEvent/** 40 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,52): warning CS1587: XML comment is not placed on a valid language element\n // /** 34 */private /** 35 */event /** 36 */System/** 37 */./** 38 */Action /** 39 */FieldLikeEvent/** 40 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,62): warning CS1587: XML comment is not placed on a valid language element\n // /** 34 */private /** 35 */event /** 36 */System/** 37 */./** 38 */Action /** 39 */FieldLikeEvent/** 40 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,78): warning CS1587: XML comment is not placed on a valid language element\n // /** 34 */private /** 35 */event /** 36 */System/** 37 */./** 38 */Action /** 39 */FieldLikeEvent/** 40 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,101): warning CS1587: XML comment is not placed on a valid language element\n // /** 34 */private /** 35 */event /** 36 */System/** 37 */./** 38 */Action /** 39 */FieldLikeEvent/** 40 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,22): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,37): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,52): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,62): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,78): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,99): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,110): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,123): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,134): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,145): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,161): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,172): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,183): warning CS1587: XML comment is not placed on a valid language element\n // /** 41 */private /** 42 */event /** 43 */System/** 44 */./** 45 */Action /** 46 */CustomEvent /** 47 */{ /** 48 */add /** 49 */{ /** 50 */} /** 51 */remove /** 52 */{ /** 53 */} /** 54 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,22): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,36): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,51): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,61): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,71): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,82): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,92): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,102): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,112): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,123): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,133): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,144): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,155): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,165): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,176): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,191): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,202): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,213): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,224): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,235): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */private /** 56 */void /** 57 */Method/** 58 */** 59 */T/** 60 */, /** 61 */U/** 62 */>/** 63 */(/** 64 */T /** 65 */t/** 66 */, /** 67 */U /** 68 */u/** 69 */) /** 70 */where /** 71 */T /** 72 */: /** 73 */U /** 74 */{ /** 75 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,21): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,37): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,50): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,68): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,78): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,88): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,99): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,109): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,120): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,131): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,147): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,157): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,168): warning CS1587: XML comment is not placed on a valid language element\n // /** 76 */public /** 77 */static /** 78 */int /** 79 */operator /** 80 */+/** 81 */(/** 82 */C /** 83 */c/** 84 */) /** 85 */{ /** 86 */return /** 87 */0/** 88 */; /** 89 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,21): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,37): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,55): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,73): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,85): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,95): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,106): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,116): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,127): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,138): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,155): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,166): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,178): warning CS1587: XML comment is not placed on a valid language element\n // /** 90 */public /** 91 */static /** 92 */explicit /** 93 */operator /** 94 */int/** 95 */(/** 96 */C /** 97 */c/** 98 */) /** 99 */{ /** 100 */return /** 101 */0/** 102 */; /** 103 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,23): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,34): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,45): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,59): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,70): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,82): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,94): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,108): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,119): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,131): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (12,143): warning CS1587: XML comment is not placed on a valid language element\n // /** 104 */private /** 105 */C/** 106 */(/** 107 */int /** 108 */x/** 109 */) /** 110 */: /** 111 */base/** 112 */(/** 113 */) /** 114 */{ /** 115 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (13,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 116 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (15,16): warning CS1587: XML comment is not placed on a valid language element\n // /** 117 */enum /** 118 */E\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (16,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 119 */{\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,16): warning CS1587: XML comment is not placed on a valid language element\n // /** 120 */A/** 121 */,\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (18,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 122 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (19,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 123 */\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"));\n }\n\n [Fact]\n public void UnprocessedXMLComment_Expressions()\n {\n var source = @\"\nclass C\n{\n private int field = 1;\n private event System.Action FieldLikeEvent = () => { return; };\n private C(int x = 1, int y = 2) { }\n private C(int x) : this(x, x + 1)\n {\n int y = x--;\n }\n}\n\nenum E\n{\n A = 1 + 1,\n}\n\";\n\n var revisedSource = new DocumentationCommentAdder().Visit(Parse(source).GetCompilationUnitRoot()).ToFullString();\n // Manually verified that positions match dev11.\n CreateCompilationUtil(revisedSource).VerifyDiagnostics(\n // (4,41): warning CS0414: The field 'C.field' is assigned but its value is never used\n // /** 3 */private /** 4 */int /** 5 */field /** 6 */= /** 7 */1/** 8 */;\n Diagnostic(ErrorCode.WRN_UnreferencedFieldAssg, \"field\").WithArguments(\"C.field\"),\n\n // (2,15): warning CS1587: XML comment is not placed on a valid language element\n // /** 0 */class /** 1 */C\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (3,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 2 */{\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (4,21): warning CS1587: XML comment is not placed on a valid language element\n // /** 3 */private /** 4 */int /** 5 */field /** 6 */= /** 7 */1/** 8 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (4,33): warning CS1587: XML comment is not placed on a valid language element\n // /** 3 */private /** 4 */int /** 5 */field /** 6 */= /** 7 */1/** 8 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (4,47): warning CS1587: XML comment is not placed on a valid language element\n // /** 3 */private /** 4 */int /** 5 */field /** 6 */= /** 7 */1/** 8 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (4,57): warning CS1587: XML comment is not placed on a valid language element\n // /** 3 */private /** 4 */int /** 5 */field /** 6 */= /** 7 */1/** 8 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (4,66): warning CS1587: XML comment is not placed on a valid language element\n // /** 3 */private /** 4 */int /** 5 */field /** 6 */= /** 7 */1/** 8 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,21): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,36): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,51): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,61): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,77): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,101): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,112): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,122): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,133): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,145): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,156): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,171): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,182): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (5,192): warning CS1587: XML comment is not placed on a valid language element\n // /** 9 */private /** 10 */event /** 11 */System/** 12 */./** 13 */Action /** 14 */FieldLikeEvent /** 15 */= /** 16 */(/** 17 */) /** 18 */=> /** 19 */{ /** 20 */return/** 21 */; /** 22 */}/** 23 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,22): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,32): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,42): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,55): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,66): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,77): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,87): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,98): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,111): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,122): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,133): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,143): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,154): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (6,165): warning CS1587: XML comment is not placed on a valid language element\n // /** 24 */private /** 25 */C/** 26 */(/** 27 */int /** 28 */x /** 29 */= /** 30 */1/** 31 */, /** 32 */int /** 33 */y /** 34 */= /** 35 */2/** 36 */) /** 37 */{ /** 38 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,22): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,32): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,42): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,55): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,65): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,76): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,87): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,100): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,110): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,120): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,131): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,142): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,153): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (7,163): warning CS1587: XML comment is not placed on a valid language element\n // /** 39 */private /** 40 */C/** 41 */(/** 42 */int /** 43 */x/** 44 */) /** 45 */: /** 46 */this/** 47 */(/** 48 */x/** 49 */, /** 50 */x /** 51 */+ /** 52 */1/** 53 */)\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (8,5): warning CS1587: XML comment is not placed on a valid language element\n // /** 54 */{\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,9): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */int /** 56 */y /** 57 */= /** 58 */x/** 59 */--/** 60 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,22): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */int /** 56 */y /** 57 */= /** 58 */x/** 59 */--/** 60 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,33): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */int /** 56 */y /** 57 */= /** 58 */x/** 59 */--/** 60 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,44): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */int /** 56 */y /** 57 */= /** 58 */x/** 59 */--/** 60 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,54): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */int /** 56 */y /** 57 */= /** 58 */x/** 59 */--/** 60 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (9,65): warning CS1587: XML comment is not placed on a valid language element\n // /** 55 */int /** 56 */y /** 57 */= /** 58 */x/** 59 */--/** 60 */;\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (10,5): warning CS1587: XML comment is not placed on a valid language element\n // /** 61 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (11,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 62 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (13,15): warning CS1587: XML comment is not placed on a valid language element\n // /** 63 */enum /** 64 */E\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (14,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 65 */{\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (15,16): warning CS1587: XML comment is not placed on a valid language element\n // /** 66 */A /** 67 */= /** 68 */1 /** 69 */+ /** 70 */1/** 71 */,\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (15,27): warning CS1587: XML comment is not placed on a valid language element\n // /** 66 */A /** 67 */= /** 68 */1 /** 69 */+ /** 70 */1/** 71 */,\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (15,38): warning CS1587: XML comment is not placed on a valid language element\n // /** 66 */A /** 67 */= /** 68 */1 /** 69 */+ /** 70 */1/** 71 */,\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (15,49): warning CS1587: XML comment is not placed on a valid language element\n // /** 66 */A /** 67 */= /** 68 */1 /** 69 */+ /** 70 */1/** 71 */,\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (15,59): warning CS1587: XML comment is not placed on a valid language element\n // /** 66 */A /** 67 */= /** 68 */1 /** 69 */+ /** 70 */1/** 71 */,\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (16,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 72 */}\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"),\n // (17,1): warning CS1587: XML comment is not placed on a valid language element\n // /** 73 */\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"));\n }\n\n [Fact]\n public void UnprocessedXMLComment_AfterAttribute()\n {\n var source = @\"\n[System.Serializable]\n/// Comment\nclass C\n{\n}\n\";\n CreateCompilationUtil(source).VerifyDiagnostics(\n // (3,1): warning CS1587: XML comment is not placed on a valid language element\n // /// Comment\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"));\n }\n\n [Fact]\n public void UnprocessedXMLComment_CompiledOut()\n {\n var source = @\"\nclass C\n{\n#if false\n/// Comment\n#endif\n}\n\";\n CreateCompilationUtil(source).VerifyDiagnostics();\n }\n\n [Fact]\n public void UnprocessedXMLComment_FilterTree()\n {\n var source1 = @\"\npartial class C\n{\n /// Unprocessed 1\n}\n\";\n var source2 = @\"\npartial class C\n{\n /// Unprocessed 2\n}\n\";\n var tree1 = Parse(source1, options: TestOptions.RegularWithDocumentationComments);\n var tree2 = Parse(source2, options: TestOptions.RegularWithDocumentationComments);\n\n var comp = CreateCompilation(new[] { tree1, tree2 });\n comp.GetSemanticModel(tree1).GetDiagnostics().Verify(\n // (4,5): warning CS1587: XML comment is not placed on a valid language element\n // /// Unprocessed 1\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"));\n comp.GetSemanticModel(tree2).GetDiagnostics().Verify(\n // (4,5): warning CS1587: XML comment is not placed on a valid language element\n // /// Unprocessed 2\n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"));\n }\n\n [Fact]\n public void UnprocessedXMLComment_Unparsed()\n {\n var source = @\"\npartial class C\n{\n /// Unprocessed 1\n}\n\";\n CreateCompilation(source).VerifyDiagnostics();\n }\n\n [WorkItem(547139, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/547139\")]\n [Fact]\n public void UnprocessedXMLComment_Accessor()\n {\n var source = @\"\nclass MyClass\n{\n string MyProperty\n {\n get;\n /// \n /// \n set;\n }\n}\n\";\n CreateCompilationUtil(source).VerifyDiagnostics(\n // (7,9): warning CS1587: XML comment is not placed on a valid language element\n // /// \n Diagnostic(ErrorCode.WRN_UnprocessedXMLComment, \"/\"));\n }\n\n /// \n /// Insert a numbered documentation comment as leading trivia on every token.\n /// \n private class DocumentationCommentAdder : CSharpSyntaxRewriter\n {\n private int _count;\n\n public override SyntaxToken VisitToken(SyntaxToken token)\n {\n var newToken = base.VisitToken(token);\n\n if (newToken.Width == 0 && newToken.Kind() != SyntaxKind.EndOfFileToken)\n {\n return newToken;\n }\n\n var existingLeadingTrivia = token.LeadingTrivia;\n var newLeadingTrivia = SyntaxFactory.ParseToken(\"/** \" + (_count++) + \" */1)\").LeadingTrivia;\n return newToken.WithLeadingTrivia(existingLeadingTrivia.Concat(newLeadingTrivia));\n }\n }\n\n #endregion WRN_UnprocessedXMLComment\n\n #region Invalid XML\n\n [Fact]\n public void InvalidXml()\n {\n var source = @\"\n/// \nclass C2 { }\n\n/// \nclass C3 { }\n\n/// \nclass C4 { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void InvalidXmlOnPartialTypes()\n {\n var source = @\"\n/// \npartial class C\n{\n}\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void InvalidXmlOnPartialMethods()\n {\n var source = @\"\npartial class C\n{\n /// \n partial void M2();\n}\n\npartial class C\n{\n /// \n partial void M1() { }\n\n /// \n\n \n Test\n \n \n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [ConditionalFact(typeof(ClrOnly), typeof(DesktopOnly))]\n [WorkItem(637435, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/637435\")]\n [WorkItem(18610, \"https://github.com/dotnet/roslyn/issues/18610\")]\n public void NonXmlWhitespace()\n {\n var ch = '\\u1680';\n Assert.True(char.IsWhiteSpace(ch));\n Assert.True(SyntaxFacts.IsWhitespace(ch));\n Assert.False(XmlCharType.IsWhiteSpace(ch));\n\n var xml = \"\";\n Assert.Throws(() => XElement.Parse(xml));\n\n var sourceTemplate = @\"\n/// {0}\nclass C {{ }}\n\";\n var source = string.Format(sourceTemplate, xml);\n\n // NOTE: separate error comment for each part.\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp,\n // (2,4): warning CS1570: XML comment has badly formed XML -- 'The '\\u1680' character, hexadecimal value 0x1680, cannot be included in a name.'\n // /// \n Diagnostic(ErrorCode.WRN_XMLParseError, \"\").WithArguments(\"The '\\u1680' character, hexadecimal value 0x1680, cannot be included in a name.\"));\n\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [ConditionalFact(typeof(ClrOnly), typeof(DesktopOnly))]\n [WorkItem(637435, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/637435\")]\n [WorkItem(18610, \"https://github.com/dotnet/roslyn/issues/18610\")]\n public void Repro637435()\n {\n var sourceTemplate = @\"\n// 1) Both Roslyn and Dev11 report an error.\n\n///\nclass C1 {{ }}\n\n\n// 2) Both Roslyn and Dev11 report an error.\n\n/// \nclass C2 {{ }}\n\n\n// 3) Both Roslyn and Dev11 report an error.\n\n///\nclass C3 {{ }}\n\n\n// 4) Dev11 reports an error, but Roslyn does not.\n\n/// \nclass C4 {{ }}\n\";\n var source = string.Format(sourceTemplate, '\\u1680');\n\n CreateCompilationUtil(source).GetDiagnostics().VerifyWithFallbackToErrorCodeOnlyForNonEnglish(\n // (4,4): warning CS1570: XML comment has badly formed XML -- 'Name cannot begin with the '\\u1680' character, hexadecimal value 0x1680.'\n // ///\n\";\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n string xmlFilePath = xmlFile.Path;\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath));\n var actual = GetDocumentationCommentText(comp);\n\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath), actual);\n }\n\n [Fact]\n public void IncludeOne()\n {\n var xml = @\"\n\n \n\n\";\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n string xmlFilePath = xmlFile.Path;\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath));\n var actual = GetDocumentationCommentText(comp);\n\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath), actual);\n }\n\n [Fact]\n public void IncludeMultiple()\n {\n var xml = @\"\n\n \n \n \n \n\n\";\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n string xmlFilePath = xmlFile.Path;\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath));\n var actual = GetDocumentationCommentText(comp);\n\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath), actual);\n }\n\n [Fact]\n public void IncludeWithChildren_Success()\n {\n var xml = @\"\n\n \n\n\";\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n string xmlFilePath = xmlFile.Path;\n\n var sourceTemplate = @\"\n/// \n/// \n/// \nclass C {{ }}\n\";\n\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath));\n var actual = GetDocumentationCommentText(comp);\n\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath), actual);\n }\n\n [Fact]\n public void IncludeWithChildren_Failure()\n {\n var xml = @\"\n\n\n\";\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n string xmlFilePath = xmlFile.Path;\n\n var sourceTemplate = @\"\n/// \n/// \n/// \nclass C {{ }}\n\";\n\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath));\n var actual = GetDocumentationCommentText(comp);\n\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath), actual);\n }\n\n [ConditionalFact(typeof(ClrOnly), typeof(DesktopOnly))]\n [WorkItem(18610, \"https://github.com/dotnet/roslyn/issues/18610\")]\n public void IncludeFileResolution()\n {\n var xml1 = @\"\n\n \n \n \n\n\";\n\n var xml2 = @\"\n\n \n \n \n\n\";\n\n var xml3 = @\"\n\n \n \n\n\";\n\n var rootDir = Temp.CreateDirectory();\n\n var dir1 = rootDir.CreateDirectory(\"d1\");\n var dir1XmlFile = dir1.CreateFile(\"test.xml\").WriteAllText(xml1);\n\n var dir2 = rootDir.CreateDirectory(\"d2\");\n var dir2XmlFile = dir2.CreateFile(\"test.xml\").WriteAllText(xml2);\n\n var dir3 = rootDir.CreateDirectory(\"d3\");\n var dir3XmlFile = dir3.CreateFile(\"test.xml\").WriteAllText(xml3);\n\n var source = @\"\n/// \nclass C { }\n\";\n var tree = Parse(source, options: TestOptions.RegularWithDocumentationComments);\n var resolver = new XmlFileResolver(rootDir.Path);\n var comp = CSharpCompilation.Create(\"Test\", new[] { tree }, new[] { MscorlibRef }, TestOptions.ReleaseDll.WithXmlReferenceResolver(resolver));\n var actual = GetDocumentationCommentText(comp);\n\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void WRN_InvalidInclude_Source()\n {\n var source = @\"\n/// \n/// \n/// \n/// \nclass C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp,\n // (2,5): warning CS1590: Invalid XML include element -- Missing file attribute\n // /// \n Diagnostic(ErrorCode.WRN_InvalidInclude, \"\").WithArguments(\"Missing file attribute\"),\n // (3,5): warning CS1590: Invalid XML include element -- Missing file attribute\n // /// \n Diagnostic(ErrorCode.WRN_InvalidInclude, \"\").WithArguments(\"Missing file attribute\"),\n // (4,5): warning CS1590: Invalid XML include element -- Missing file attribute\n // /// \n Diagnostic(ErrorCode.WRN_InvalidInclude, \"\").WithArguments(\"Missing file attribute\"),\n // (5,5): warning CS1590: Invalid XML include element -- Missing path attribute\n // /// \n Diagnostic(ErrorCode.WRN_InvalidInclude, \"\").WithArguments(\"Missing path attribute\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void WRN_InvalidInclude_Xml()\n {\n var xml = @\"\n\n \n \n \n \n\n\";\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFile.Path));\n var actual = GetDocumentationCommentText(comp,\n // warning CS1590: Invalid XML include element -- Missing file attribute\n Diagnostic(ErrorCode.WRN_InvalidInclude).WithArguments(\"Missing file attribute\"),\n // warning CS1590: Invalid XML include element -- Missing file attribute\n Diagnostic(ErrorCode.WRN_InvalidInclude).WithArguments(\"Missing file attribute\"),\n // warning CS1590: Invalid XML include element -- Missing file attribute\n Diagnostic(ErrorCode.WRN_InvalidInclude).WithArguments(\"Missing file attribute\"),\n // warning CS1590: Invalid XML include element -- Missing path attribute\n Diagnostic(ErrorCode.WRN_InvalidInclude).WithArguments(\"Missing path attribute\"));\n\n // NOTE: the whitespace is external to the selected nodes, so it's not included.\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void WRN_FailedInclude_NonExistent_Source()\n {\n var source = @\"\n/// \nclass C { }\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp,\n // (2,5): warning CS1589: Unable to include XML fragment 'path' of file 'file' -- File not found.\n // /// \n Diagnostic(ErrorCode.WRN_FailedInclude, \"\").WithArguments(\"file\", \"path\", \"File not found.\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void WRN_FailedInclude_NonExistent_Xml()\n {\n var xml = @\"\n\n \n\n\";\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFile.Path));\n var actual = GetDocumentationCommentText(comp,\n // 56e57d80-44fc-4e2c-b839-0bf3d9c830b7.xml(3,6): warning CS1589: Unable to include XML fragment 'path' of file 'file' -- File not found.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(\"file\", \"path\", \"File not found.\"));\n\n // NOTE: the whitespace is external to the selected nodes, so it's not included.\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [ClrOnlyFact(ClrOnlyReason.Unknown)]\n public void WRN_FailedInclude_Locked_Source()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\");\n var xmlFilePath = xmlFile.Path;\n\n var includeTemplate = \"\";\n var includeElement = string.Format(includeTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n/// {0}\nclass C {{ }}\n\";\n using (File.Open(xmlFilePath, FileMode.Open, FileAccess.Write, FileShare.None))\n {\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n var actual = GetDocumentationCommentText(comp,\n // (2,5): warning CS1589: Unable to include XML fragment 'path' of file 'c3af0dc5a3cf.xml' -- The process cannot access the file 'c3af0dc5a3cf.xml' because it is being used by another process.\n // /// \n Diagnostic(ErrorCode.WRN_FailedInclude, includeElement).WithArguments(xmlFilePath, \"path\", string.Format(\"The process cannot access the file '{0}' because it is being used by another process.\", xmlFilePath)));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath), actual);\n }\n }\n\n [ClrOnlyFact(ClrOnlyReason.Unknown)]\n public void WRN_FailedInclude_Locked_Xml()\n {\n var xmlFile1 = Temp.CreateFile(extension: \".xml\");\n var xmlFilePath1 = xmlFile1.Path;\n\n var xmlFile2 = Temp.CreateFile(extension: \".xml\").WriteAllText(string.Format(\"\", xmlFilePath1));\n var xmlFilePath2 = xmlFile2.Path;\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n using (File.Open(xmlFilePath1, FileMode.Open, FileAccess.Write, FileShare.None))\n {\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath2));\n var actual = GetDocumentationCommentText(comp,\n // 3fba660141b6.xml(1,2): warning CS1589: Unable to include XML fragment 'path' of file 'd4241d125755.xml' -- The process cannot access the file 'd4241d125755.xml' because it is being used by another process.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(xmlFilePath1, \"path\", string.Format(\"The process cannot access the file '{0}' because it is being used by another process.\", xmlFilePath1)));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath1), actual);\n }\n }\n\n [Fact]\n public void WRN_FailedInclude_XPath_Source()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeTemplate = \"\";\n var includeElement = string.Format(includeTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n/// {0}\nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n var actual = GetDocumentationCommentText(comp,\n // (2,5): warning CS1589: Unable to include XML fragment 'path' of file 'c3af0dc5a3cf.xml' -- The process cannot access the file 'c3af0dc5a3cf.xml' because it is being used by another process.\n // /// \n Diagnostic(ErrorCode.WRN_FailedInclude, includeElement).WithArguments(xmlFilePath, \":\", \"':' has an invalid token.\"));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath), actual);\n }\n\n [Fact]\n public void WRN_FailedInclude_XPath_Xml()\n {\n var xmlFile1 = Temp.CreateFile(extension: \".xml\").WriteAllText(\"\");\n var xmlFilePath1 = xmlFile1.Path;\n\n var xmlFile2 = Temp.CreateFile(extension: \".xml\").WriteAllText(string.Format(\"\", xmlFilePath1));\n var xmlFilePath2 = xmlFile2.Path;\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath2));\n var actual = GetDocumentationCommentText(comp,\n // 3fba660141b6.xml(1,2): warning CS1589: Unable to include XML fragment 'path' of file 'd4241d125755.xml' -- The process cannot access the file 'd4241d125755.xml' because it is being used by another process.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(xmlFilePath1, \":\", \"':' has an invalid token.\"));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath1), actual);\n }\n\n [ClrOnlyFact(ClrOnlyReason.DocumentationComment, Skip = \"https://github.com/dotnet/roslyn/issues/8807\")]\n public void WRN_XMLParseIncludeError_Source()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeTemplate = \"\";\n var includeElement = string.Format(includeTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n/// {0}\nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n var actual = GetDocumentationCommentText(comp,\n // 327697461814.xml(1,19): warning CS1592: Badly formed XML in included comments file -- 'Unexpected end of file has occurred. The following elements are not closed: OpenWithoutClose.'\n Diagnostic(ErrorCode.WRN_XMLParseIncludeError).WithArguments(\"Unexpected end of file has occurred. The following elements are not closed: OpenWithoutClose.\"));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, TestHelpers.AsXmlCommentText(xmlFilePath)), actual);\n }\n\n [ConditionalFact(typeof(ClrOnly), typeof(DesktopOnly))]\n [WorkItem(18610, \"https://github.com/dotnet/roslyn/issues/18610\")]\n public void WRN_XMLParseIncludeError_Xml()\n {\n var xmlFile1 = Temp.CreateFile(extension: \".xml\").WriteAllText(\"\");\n var xmlFilePath1 = xmlFile1.Path;\n\n var xmlFile2 = Temp.CreateFile(extension: \".xml\").WriteAllText(string.Format(\"\", xmlFilePath1));\n var xmlFilePath2 = xmlFile2.Path;\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath2));\n var actual = GetDocumentationCommentText(comp,\n // 408eee49f410.xml(1,19): warning CS1592: Badly formed XML in included comments file -- 'Unexpected end of file has occurred. The following elements are not closed: OpenWithoutClose.'\n Diagnostic(ErrorCode.WRN_XMLParseIncludeError).WithArguments(\"Unexpected end of file has occurred. The following elements are not closed: OpenWithoutClose.\"));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath2), actual);\n }\n\n [Fact]\n public void IncludeCycle_Simple()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\");\n var xmlFilePath = xmlFile.Path;\n\n xmlFile.WriteAllText(string.Format(@\"\", xmlFilePath)); //Includes itself.\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath));\n var actual = GetDocumentationCommentText(comp,\n // 3fba660141b6.xml(1,2): warning CS1589: Unable to include XML fragment 'path' of file 'd4241d125755.xml' -- The process cannot access the file 'd4241d125755.xml' because it is being used by another process.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(xmlFilePath, \"//include\", \"Operation caused a stack overflow.\"));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath), actual);\n }\n\n [Fact]\n public void IncludeCycle_Containment()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\");\n var xmlFilePath = xmlFile.Path;\n\n xmlFile.WriteAllText(string.Format(@\"\", xmlFilePath)); //Includes its parent.\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath));\n\n // CONSIDER: differs from dev11, but this is a reasonable recovery.\n var actual = GetDocumentationCommentText(comp,\n // 3fba660141b6.xml(1,2): warning CS1589: Unable to include XML fragment 'path' of file 'd4241d125755.xml' -- The process cannot access the file 'd4241d125755.xml' because it is being used by another process.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(xmlFilePath, \"//parent\", \"Operation caused a stack overflow.\"));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath), actual);\n }\n\n [Fact]\n public void IncludeCycle_Nesting()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\");\n var xmlFilePath = xmlFile.Path;\n\n xmlFile.WriteAllText(string.Format(@\"\n\n \n\", xmlFilePath)); //Everything includes everything, includes within includes.\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath));\n\n // CONSIDER: not checked against dev11 - just don't blow up.\n var actual = GetDocumentationCommentText(comp,\n // 1dc0fa5fb526.xml(2,2): warning CS1589: Unable to include XML fragment '//include' of file '1dc0fa5fb526.xml' -- Operation caused a stack overflow.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(xmlFilePath, \"//include\", \"Operation caused a stack overflow.\"),\n // 1dc0fa5fb526.xml(2,2): warning CS1589: Unable to include XML fragment '//include' of file '1dc0fa5fb526.xml' -- Operation caused a stack overflow.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(xmlFilePath, \"//include\", \"Operation caused a stack overflow.\"),\n // 1dc0fa5fb526.xml(2,2): warning CS1589: Unable to include XML fragment '//include' of file '1dc0fa5fb526.xml' -- Operation caused a stack overflow.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(xmlFilePath, \"//include\", \"Operation caused a stack overflow.\"),\n // 1dc0fa5fb526.xml(3,6): warning CS1589: Unable to include XML fragment '//include' of file '1dc0fa5fb526.xml' -- Operation caused a stack overflow.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(xmlFilePath, \"//include\", \"Operation caused a stack overflow.\"),\n // 1dc0fa5fb526.xml(3,6): warning CS1589: Unable to include XML fragment '//include' of file '1dc0fa5fb526.xml' -- Operation caused a stack overflow.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(xmlFilePath, \"//include\", \"Operation caused a stack overflow.\"),\n // 1dc0fa5fb526.xml(3,6): warning CS1589: Unable to include XML fragment '//include' of file '1dc0fa5fb526.xml' -- Operation caused a stack overflow.\n Diagnostic(ErrorCode.WRN_FailedInclude).WithArguments(xmlFilePath, \"//include\", \"Operation caused a stack overflow.\"));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n\n \n\n \n\n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath), actual);\n }\n\n // It should be legal to include the same acyclic element along multiple paths - that isn't a cycle.\n [Fact]\n public void IncludeAlongMultiplePaths()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\");\n var xmlFilePath = xmlFile.Path;\n\n string xmlTemplate = @\"\n\n \n \n\";\n xmlFile.WriteAllText(string.Format(xmlTemplate, xmlFilePath));\n\n var sourceTemplate = @\"\n/// \n/// \nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath));\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n // As in dev11, the xpath is evaluated *before* includes are expanded.\n [Fact]\n public void XPathAssumesExpandedInclude()\n {\n var xmlFile1 = Temp.CreateFile(extension: \".xml\");\n var xmlFilePath1 = xmlFile1.Path;\n\n var xmlFile2 = Temp.CreateFile(extension: \".xml\");\n var xmlFilePath2 = xmlFile2.Path;\n\n string xmlTemplate1 = @\"\";\n string xml2 = @\"\";\n\n xmlFile1.WriteAllText(string.Format(xmlTemplate1, xmlFilePath2));\n xmlFile2.WriteAllText(xml2);\n\n var sourceTemplate = @\"\n/// \nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath1));\n\n var actual = GetDocumentationCommentText(comp);\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(string.Format(expectedTemplate, xmlFilePath1), actual);\n }\n\n [WorkItem(554196, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554196\")]\n [Fact]\n public void XPathDocumentRoot()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\");\n var xmlFilePath = xmlFile.Path;\n\n xmlFile.WriteAllText(@\"\n\n \n Roslyn.Utilities\n \n \n \n\");\n\n var sourceTemplate = @\"\n/// \nenum A {{ }}\n\n/// \nenum B {{ }}\n\n/// \nenum C {{ }}\n\n/// \nenum D {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFilePath));\n\n var actual = GetDocumentationCommentText(comp,\n // (2,5): warning CS1589: Unable to include XML fragment '/' of file '012bf028d62c.xml' -- The XPath expression evaluated to unexpected type System.Xml.Linq.XDocument.\n // /// \n Diagnostic(ErrorCode.WRN_FailedInclude, string.Format(@\"\", xmlFilePath)).WithArguments(xmlFilePath, \"/\", \"The XPath expression evaluated to unexpected type System.Xml.Linq.XDocument.\"),\n // (5,5): warning CS1589: Unable to include XML fragment '.' of file '012bf028d62c.xml' -- The XPath expression evaluated to unexpected type System.Xml.Linq.XDocument.\n // /// \n Diagnostic(ErrorCode.WRN_FailedInclude, string.Format(@\"\", xmlFilePath)).WithArguments(xmlFilePath, \".\", \"The XPath expression evaluated to unexpected type System.Xml.Linq.XDocument.\"));\n\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n \n \n \n \n \n Roslyn.Utilities\n \n \n \n\n \n \n \n \n Roslyn.Utilities\n \n \n \n\n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n #region Included crefs\n\n [Fact]\n public void IncludedCref_Valid()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(@\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n/// {0}\nclass C\n{{\n static void Main() {{ }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void IncludedCref_Verbatim()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(@\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n/// {0}\nclass C\n{{\n static void Main() {{ }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void IncludedCref_MultipleSyntaxTrees()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(@\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\nnamespace N\n{{\n /// {0}\n class C {{ }}\n}}\n\nnamespace N\n{{\n using System;\n\n /// {0}\n class C {{ }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n // Error for the first include, but not for the second.\n var actual = GetDocumentationCommentText(comp,\n // (4,9): warning CS1574: XML comment has cref attribute 'Int32' that could not be resolved\n Diagnostic(ErrorCode.WRN_BadXMLRef, includeElement).WithArguments(\"Int32\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void IncludedCref_SyntaxError()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(@\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n/// {0}\nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp,\n // (2,5): warning CS1584: XML comment has syntactically incorrect cref attribute '#'\n // /// \n Diagnostic(ErrorCode.WRN_BadXMLRefSyntax, includeElement).WithArguments(\"#\"),\n // (2,5): warning CS1658: Identifier expected. See also error CS1001.\n // /// \n Diagnostic(ErrorCode.WRN_ErrorOverride, includeElement).WithArguments(\"Identifier expected\", \"1001\"),\n // (2,5): warning CS1658: Unexpected character '#'. See also error CS1056.\n // /// \n Diagnostic(ErrorCode.WRN_ErrorOverride, includeElement).WithArguments(\"Unexpected character '#'\", \"1056\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void IncludedCref_SemanticError()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(@\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n/// {0}\nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp,\n // (2,5): warning CS1574: XML comment has cref attribute 'Invalid' that could not be resolved\n // /// \n Diagnostic(ErrorCode.WRN_BadXMLRef, includeElement).WithArguments(\"Invalid\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [WorkItem(552495, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/552495\")]\n [Fact]\n public void IncludeMismatchedQuotationMarks()\n {\n var source = @\"\n/// \n/// \";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\nclass X\n{{\n /// {0}\n /// {1}\n public class Y : X\n {{\n public static implicit operator Y(int x)\n {{\n return null;\n }}\n }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, seeElement, includeElement));\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [WorkItem(586815, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/586815\")]\n [Fact]\n public void CrefParameterOrReturnTypeLookup2()\n {\n var seeElement = @\"\";\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(seeElement);\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\nclass A\n{{\n class B : A\n {{\n /// {0}\n /// {1}\n void Foo(B x) {{ }}\n }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, seeElement, includeElement));\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n #endregion Included crefs\n\n #region Included names\n\n [Fact]\n public void IncludedName_Success()\n {\n var xml = @\"\n\n \n \n Text\n Text\n \n \n \n \n Text\n Text\n \n \n \n \n Text\n Text\n Text\n Text\n \n \n \n \n Text\n Text\n Text\n Text\n \n \n\n\";\n\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n string[] includeElements = Enumerable.Range(0, 4).Select(i => string.Format(includeElementTemplate, xmlFilePath, i)).ToArray();\n\n var sourceTemplate = @\"\n/// {0}\nclass C\n{{\n /// {1}\n int this[int x] {{ get {{ return 0; }} set {{ }} }}\n \n /// {2}\n void M(U u) {{ }}\n\n /// {3}\n delegate void D(V v) {{ }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElements));\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n Text\n Text\n \n \n \n \n Text\n Text\n \n \n \n \n Text\n Text\n Text\n Text\n \n \n \n \n Text\n Text\n Text\n Text\n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void IncludedName_OverlappedWithSource()\n {\n var xml = @\"\n\n Text\n Text\n Text\n Text\n Text\n Text\n Text\n Text\n\n\";\n\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n string includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n/// Text\n/// Text\n/// Text\n/// Text\n/// Text\n/// Text\n/// Text\n/// Text\n/// {0}\ndelegate void D(U u, V v);\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp,\n // (10,5): warning CS1571: XML comment has a duplicate param tag for 'u'\n // /// \n Diagnostic(ErrorCode.WRN_DuplicateParamTag, includeElement).WithArguments(\"u\"),\n // (10,5): warning CS1571: XML comment has a duplicate param tag for 'v'\n // /// \n Diagnostic(ErrorCode.WRN_DuplicateParamTag, includeElement).WithArguments(\"v\"),\n // (10,5): warning CS1710: XML comment has a duplicate typeparam tag for 'U'\n // /// \n Diagnostic(ErrorCode.WRN_DuplicateTypeParamTag, includeElement).WithArguments(\"U\"),\n // (10,5): warning CS1710: XML comment has a duplicate typeparam tag for 'V'\n // /// \n Diagnostic(ErrorCode.WRN_DuplicateTypeParamTag, includeElement).WithArguments(\"V\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n Text\n Text\n Text\n Text\n Text\n Text\n Text\n Text\n TextTextTextTextTextTextTextText\n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void IncludedName_MixedWithSource()\n {\n var xml = @\"\n\n Text\n Text\n Text\n Text\n Text\n Text\n\n\";\n\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n string includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n/// Text\n/// Text\n/// Text\n/// Text\n/// Text\n/// Text\n/// {0}\ndelegate void D(U u, V v);\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n Text\n Text\n Text\n Text\n Text\n Text\n TextTextTextTextTextText\n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void IncludedName_SyntacticError()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(@\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n/// {0}\nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp,\n // (2,5): warning CS1658: Unexpected character '#'. See also error CS1056.\n // /// \n Diagnostic(ErrorCode.WRN_ErrorOverride, includeElement).WithArguments(\"Unexpected character '#'\", \"1056\"),\n // (3,9): warning CS1712: Type parameter 'T' has no matching typeparam tag in the XML comment on 'C' (but other type parameters do)\n // class C { }\n Diagnostic(ErrorCode.WRN_MissingTypeParamTag, \"T\").WithArguments(\"T\", \"C\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void IncludedName_SemanticError()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(@\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\nclass C\n{{ \n /// {0}\n void M(int x) {{ }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp,\n // (4,9): warning CS1572: XML comment has a param tag for 'Q', but there is no parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedParamTag, includeElement).WithArguments(\"Q\"),\n // (5,16): warning CS1573: Parameter 'x' has no matching param tag in the XML comment for 'C.M(int)' (but other parameters do)\n // void M(int x) { }\n Diagnostic(ErrorCode.WRN_MissingParamTag, \"x\").WithArguments(\"x\", \"C.M(int)\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void IncludedName_DuplicateParameterName()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(@\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\nclass C\n{{ \n /// {0}\n void M(int x, int x) {{ }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n // NOTE: no *xml* diagnostics, not no diagnostics.\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n [ClrOnlyFact(ClrOnlyReason.DocumentationComment, Skip = \"https://github.com/dotnet/roslyn/issues/8807\")]\n public void IncludedName_DuplicateNameAttribute()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(@\"\");\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\nclass C\n{{ \n /// {0}\n void M(int x, int y) {{ }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp,\n // df33b60df5a9.xml(1,17): warning CS1592: Badly formed XML in included comments file -- ''name' is a duplicate attribute name.'\n Diagnostic(ErrorCode.WRN_XMLParseIncludeError).WithArguments(\"'name' is a duplicate attribute name.\"));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n \").Trim();\n Assert.Equal(string.Format(expectedTemplate, TestHelpers.AsXmlCommentText(xmlFilePath)), actual);\n }\n\n [Fact]\n public void IncludedName_PartialMethod()\n {\n string xml = @\"\n\n \n \n\";\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n var includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\npartial class C\n{{ \n /// Part 1.\n /// {0}\n partial void M(int x, int y);\n}}\n\npartial class C\n{{ \n /// Part 2.\n /// {0}\n partial void M(int x, int y) {{ }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp);\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n Part 2.\n \n \n \n\n \").Trim();\n Assert.Equal(string.Format(expectedTemplate, TestHelpers.AsXmlCommentText(xmlFilePath)), actual);\n }\n\n [Fact]\n [WorkItem(21348, \"https://github.com/dotnet/roslyn/issues/21348\")]\n public void IncludedName_TypeParamAndTypeParamRefHandling()\n {\n var xml = @\"\n\n \n Included section\n \n See .\n See .\n See .\n See .\n \n \n \n \n Included section\n \n See .\n See .\n See .\n See .\n \n \n \n\n\";\n\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(xml);\n var xmlFilePath = xmlFile.Path;\n\n var includeElementTemplate = @\"\";\n string includeElement = string.Format(includeElementTemplate, xmlFilePath);\n\n var sourceTemplate = @\"\n\n/// {0}\nclass OuterClass\n{{\n /// {0}\n class InnerClass\n {{\n /// {0}\n public void Foo() {{}}\n }}\n}}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, includeElement));\n\n var actual = GetDocumentationCommentText(comp, expectedDiagnostics: new[] {\n // (3,5): warning CS1711: XML comment has a typeparam tag for 'Y', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamTag, includeElement).WithArguments(\"Y\").WithLocation(3, 5),\n // (3,5): warning CS1711: XML comment has a typeparam tag for 'XY', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamTag, includeElement).WithArguments(\"XY\").WithLocation(3, 5),\n // (3,5): warning CS1735: XML comment on 'OuterClass' has a typeparamref tag for 'Y', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamRefTag, includeElement).WithArguments(\"Y\", \"OuterClass\").WithLocation(3, 5),\n // (3,5): warning CS1735: XML comment on 'OuterClass' has a typeparamref tag for 'XY', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamRefTag, includeElement).WithArguments(\"XY\", \"OuterClass\").WithLocation(3, 5),\n // (6,9): warning CS1711: XML comment has a typeparam tag for 'X', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamTag, includeElement).WithArguments(\"X\").WithLocation(6, 9),\n // (6,9): warning CS1711: XML comment has a typeparam tag for 'XY', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamTag, includeElement).WithArguments(\"XY\").WithLocation(6, 9),\n // (6,9): warning CS1735: XML comment on 'OuterClass.InnerClass' has a typeparamref tag for 'XY', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamRefTag, includeElement).WithArguments(\"XY\", \"OuterClass.InnerClass\").WithLocation(6, 9),\n // (9,13): warning CS1711: XML comment has a typeparam tag for 'X', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamTag, includeElement).WithArguments(\"X\").WithLocation(9, 13),\n // (9,13): warning CS1711: XML comment has a typeparam tag for 'Y', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamTag, includeElement).WithArguments(\"Y\").WithLocation(9, 13),\n // (9,13): warning CS1711: XML comment has a typeparam tag for 'XY', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamTag, includeElement).WithArguments(\"XY\").WithLocation(9, 13),\n // (9,13): warning CS1735: XML comment on 'OuterClass.InnerClass.Foo()' has a typeparamref tag for 'XY', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamRefTag, includeElement).WithArguments(\"XY\", \"OuterClass.InnerClass.Foo()\").WithLocation(9, 13)\n });\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n Included section\n \n See .\n See .\n See .\n See .\n \n \n \n Included section\n \n See .\n See .\n See .\n See .\n \n \n \n \n \n \n Included section\n \n See .\n See .\n See .\n See .\n \n \n \n Included section\n \n See .\n See .\n See .\n See .\n \n \n \n \n \n \n Included section\n \n See .\n See .\n See .\n See .\n \n \n \n Included section\n \n See .\n See .\n See .\n See .\n \n \n \n \n \n\n \").Trim();\n Assert.Equal(expected, actual);\n }\n\n #endregion Included names\n\n #endregion Include\n\n #region For single symbol\n\n [Fact]\n public void ForSingleType()\n {\n var source = @\"\n/// \n/// A\n/// B\n/// C\n/// \nclass C { }\n\";\n\n var compilation = CreateCompilationUtil(source);\n\n var type = compilation.GlobalNamespace.GetMember(\"C\");\n var actualText = DocumentationCommentCompiler.GetDocumentationCommentXml(type, processIncludes: true, cancellationToken: default(CancellationToken));\n var expectedText =\n@\"\n \n A\n B\n C\n \n\n\";\n Assert.Equal(expectedText, actualText);\n }\n\n [Fact]\n public void ForSingleTypeWithInclude()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(\"\");\n var xmlFilePath = xmlFile.Path;\n\n var sourceTemplate = @\"\n/// \n/// A\n/// \n/// C\n/// \nclass C \n{{\n /// Shouldn't appear in doc comment for C.\n void M(){{}}\n}}\n\";\n var source = string.Format(sourceTemplate, xmlFilePath);\n\n var compilation = CreateCompilationUtil(source);\n\n var type = compilation.GlobalNamespace.GetMember(\"C\");\n\n // Expand includes.\n {\n var actualText = DocumentationCommentCompiler.GetDocumentationCommentXml(type, processIncludes: true, cancellationToken: default(CancellationToken));\n var expectedText =\n @\"\n \n A\n \n C\n \n\n\";\n Assert.Equal(expectedText, actualText);\n }\n\n // Do not expand includes.\n {\n var actualText = DocumentationCommentCompiler.GetDocumentationCommentXml(type, processIncludes: false, cancellationToken: default(CancellationToken));\n var expectedTextTemplate =\n @\"\n \n A\n \n C\n \n\n\";\n Assert.Equal(string.Format(expectedTextTemplate, xmlFilePath), actualText);\n }\n }\n\n #endregion\n\n #region Misc\n\n [Fact]\n public void FilterTree()\n {\n var source1 = @\"\npartial class C\n{\n /// \n void M1() { }\n}\n\";\n\n var source2 = @\"\npartial class C\n{\n /// \n void M2() { }\n}\n\";\n\n var tree1 = SyntaxFactory.ParseSyntaxTree(source1, options: TestOptions.RegularWithDocumentationComments);\n var tree2 = SyntaxFactory.ParseSyntaxTree(source2, options: TestOptions.RegularWithDocumentationComments);\n\n // Files passed in order.\n var comp = CreateCompilation(new[] { tree1, tree2 }, assemblyName: \"Test\");\n\n var actual1 = GetDocumentationCommentText(comp, null, filterTree: tree1, expectedDiagnostics: new[] {\n // (4,20): warning CS1574: XML comment has cref attribute 'Bogus1' that could not be resolved\n // /// \n Diagnostic(ErrorCode.WRN_BadXMLRef, \"Bogus1\").WithArguments(\"Bogus1\") });\n var expected1 = @\"\n\n\n \n Test\n \n \n \n \n \n \n\n\".Trim();\n Assert.Equal(expected1, actual1);\n\n var actual2 = GetDocumentationCommentText(comp, null, filterTree: tree2, expectedDiagnostics: new[] {\n // (4,20): warning CS1574: XML comment has cref attribute 'Bogus2' that could not be resolved\n // /// \n Diagnostic(ErrorCode.WRN_BadXMLRef, \"Bogus2\").WithArguments(\"Bogus2\")});\n var expected2 = @\"\n\n\n \n Test\n \n \n \n \n \n \n\n\".Trim();\n Assert.Equal(expected2, actual2);\n }\n\n [Fact]\n public void Utf8()\n {\n // NOTE: This character is interesting because it has a three-byte utf-8 representation.\n var source = \"///\\u20ac\" + @\"\npublic class C\n{\n static void Main() {}\n}\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp, \"OutputName\");\n var expected = (@\"\n\n\n \n OutputName\n \n \n \n \" + \"\\u20ac\" + @\"\n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact, WorkItem(921838, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/921838\")]\n public void InaccessibleMembers()\n {\n var source =\n@\"/// \n/// See .\n/// \nclass A\n{\n}\n\nclass C\n{\n private void M() { }\n}\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp, \"OutputName\");\n var expected = (@\"\n\n\n \n OutputName\n \n \n \n \n See .\n \n \n \n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [WorkItem(531144, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531144\")]\n [Fact]\n public void NamespaceCref()\n {\n var source = @\"\n/// \npublic class C\n{\n static void Main() {}\n}\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [WorkItem(531144, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531144\")]\n [Fact]\n public void SymbolKinds()\n {\n var source = @\"\nusing AliasN = System;\nusing AliasT = System.String;\n\nclass Generic\n{\n /// \n /// Namespace alias \n /// Type alias \n /// Array type -- warning\n /// There's no way to get a cref to bind to an assembly.\n /// Dynamic type -- warning\n /// Error type -- warning\n /// Event \n /// Field \n /// There's no way to get a cref to bind to a label.\n /// There's no way to get a cref to bind to a local.\n /// Method \n /// There's no way to get a cref to bind to a net module.\n /// Named type \n /// Namespace \n /// There's no way to get a cref to bind to a parameter.\n /// Pointer type -- warning\n /// Property \n /// There's no way to get a cref to bind to a range variable.\n /// Type parameter -- warning\n /// \n public class C\n {\n int f;\n event System.Action E;\n int P { get; set; }\n void M() {}\n }\n}\n\";\n var comp = CreateCompilationUtil(source);\n comp.VerifyDiagnostics(\n\n // Cref parse warnings.\n\n // (10,31): warning CS1584: XML comment has syntactically incorrect cref attribute 'C[]'\n // /// Array type -- warning\n Diagnostic(ErrorCode.WRN_BadXMLRefSyntax, \"C\").WithArguments(\"C[]\"),\n // (23,33): warning CS1584: XML comment has syntactically incorrect cref attribute 'C*'\n // /// Pointer type -- warning\n Diagnostic(ErrorCode.WRN_BadXMLRefSyntax, \"C\").WithArguments(\"C*\"),\n\n // Boring warnings.\n\n // (31,29): warning CS0067: The event 'Generic.C.E' is never used\n // event System.Action E;\n Diagnostic(ErrorCode.WRN_UnreferencedEvent, \"E\").WithArguments(\"Generic.C.E\"),\n // (30,13): warning CS0169: The field 'Generic.C.f' is never used\n // int f;\n Diagnostic(ErrorCode.WRN_UnreferencedField, \"f\").WithArguments(\"Generic.C.f\"),\n\n // Cref binding warnings.\n\n // (12,33): warning CS1574: XML comment has cref attribute 'dynamic' that could not be resolved\n // /// Dynamic type -- warning\n Diagnostic(ErrorCode.WRN_BadXMLRef, \"dynamic\").WithArguments(\"dynamic\"),\n // (13,31): warning CS1574: XML comment has cref attribute 'C{T}' that could not be resolved\n // /// Error type -- warning\n Diagnostic(ErrorCode.WRN_BadXMLRef, \"C{T}\").WithArguments(\"C{T}\"),\n // (26,35): warning CS1723: XML comment has cref attribute 'T' that refers to a type parameter\n // /// Type parameter -- warning\n Diagnostic(ErrorCode.WRN_BadXMLRefTypeVar, \"T\").WithArguments(\"T\"));\n\n var actual = GetDocumentationCommentText(comp,\n // (12,33): warning CS1574: XML comment has cref attribute 'dynamic' that could not be resolved\n // /// Dynamic type -- warning\n Diagnostic(ErrorCode.WRN_BadXMLRef, \"dynamic\").WithArguments(\"dynamic\"),\n // (13,31): warning CS1574: XML comment has cref attribute 'C{T}' that could not be resolved\n // /// Error type -- warning\n Diagnostic(ErrorCode.WRN_BadXMLRef, \"C{T}\").WithArguments(\"C{T}\"),\n // (26,35): warning CS1723: XML comment has cref attribute 'T' that refers to a type parameter\n // /// Type parameter -- warning\n Diagnostic(ErrorCode.WRN_BadXMLRefTypeVar, \"T\").WithArguments(\"T\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n Namespace alias \n Type alias \n Array type -- warning\n There's no way to get a cref to bind to an assembly.\n Dynamic type -- warning\n Error type -- warning\n Event \n Field \n There's no way to get a cref to bind to a label.\n There's no way to get a cref to bind to a local.\n Method \n There's no way to get a cref to bind to a net module.\n Named type \n Namespace \n There's no way to get a cref to bind to a parameter.\n Pointer type -- warning\n Property \n There's no way to get a cref to bind to a range variable.\n Type parameter -- warning\n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [WorkItem(530695, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530695\")]\n [Fact]\n public void FieldDocComment()\n {\n var source = @\"\nclass C\n{\n /// 1\n int f;\n /// 2\n int g, h;\n\n /// 3\n event System.Action p;\n /// 4\n event System.Action q, r;\n}\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n 1\n \n \n 2\n \n \n 2\n \n \n 3\n \n \n 4\n \n \n 4\n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [WorkItem(530695, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530695\")]\n [Fact]\n public void FieldDocCommentDiagnostics()\n {\n var source = @\"\nclass C\n{\n /// \n int f;\n /// \n int g, h;\n\n /// \n event System.Action p;\n /// \n event System.Action q, r;\n}\n\";\n // Duplicate diagnostics, as in dev11.\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp,\n // (4,20): warning CS1574: XML comment has cref attribute 'fake1' that could not be resolved\n // /// \n Diagnostic(ErrorCode.WRN_BadXMLRef, \"fake1\").WithArguments(\"fake1\"),\n // (6,20): warning CS1574: XML comment has cref attribute 'fake2' that could not be resolved\n // /// \n Diagnostic(ErrorCode.WRN_BadXMLRef, \"fake2\").WithArguments(\"fake2\"),\n // (6,20): warning CS1574: XML comment has cref attribute 'fake2' that could not be resolved\n // /// \n Diagnostic(ErrorCode.WRN_BadXMLRef, \"fake2\").WithArguments(\"fake2\"),\n // (9,20): warning CS1574: XML comment has cref attribute 'fake3' that could not be resolved\n // /// \n Diagnostic(ErrorCode.WRN_BadXMLRef, \"fake3\").WithArguments(\"fake3\"),\n // (11,20): warning CS1574: XML comment has cref attribute 'fake4' that could not be resolved\n // /// \n Diagnostic(ErrorCode.WRN_BadXMLRef, \"fake4\").WithArguments(\"fake4\"),\n // (11,20): warning CS1574: XML comment has cref attribute 'fake4' that could not be resolved\n // /// \n Diagnostic(ErrorCode.WRN_BadXMLRef, \"fake4\").WithArguments(\"fake4\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [WorkItem(531187, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531187\")]\n [Fact]\n public void DelegateDocComments()\n {\n var source = @\"\n/// \n/// \n/// \n/// \n/// \n/// \n/// \n/// \ndelegate void D(T t, U u);\n\";\n var comp = CreateCompilationUtil(source);\n var actual = GetDocumentationCommentText(comp,\n // (3,18): warning CS1572: XML comment has a param tag for 'q', but there is no parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedParamTag, \"q\").WithArguments(\"q\"),\n // (5,21): warning CS1734: XML comment on 'D' has a paramref tag for 'q', but there is no parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedParamRefTag, \"q\").WithArguments(\"q\", \"D\"),\n // (7,22): warning CS1711: XML comment has a typeparam tag for 'Q', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamTag, \"Q\").WithArguments(\"Q\"),\n // (9,25): warning CS1735: XML comment on 'D' has a typeparamref tag for 'Q', but there is no type parameter by that name\n // /// \n Diagnostic(ErrorCode.WRN_UnmatchedTypeParamRefTag, \"Q\").WithArguments(\"Q\", \"D\"),\n // (10,30): warning CS1573: Parameter 'u' has no matching param tag in the XML comment for 'D' (but other parameters do)\n // delegate void D(T t, U u);\n Diagnostic(ErrorCode.WRN_MissingParamTag, \"u\").WithArguments(\"u\", \"D\"),\n // (10,20): warning CS1712: Type parameter 'U' has no matching typeparam tag in the XML comment on 'D' (but other type parameters do)\n // delegate void D(T t, U u);\n Diagnostic(ErrorCode.WRN_MissingTypeParamTag, \"U\").WithArguments(\"U\", \"D\"));\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void NoWarn1591()\n {\n var source = @\"\npublic class C { }\n\";\n var tree = Parse(source, options: TestOptions.RegularWithDocumentationComments);\n var warnDict = new Dictionary { { MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_MissingXMLComment), ReportDiagnostic.Suppress } };\n var comp = CreateCompilation(tree, options: TestOptions.ReleaseDll.WithSpecificDiagnosticOptions(warnDict), assemblyName: \"Test\");\n comp.VerifyDiagnostics(); //NOTE: no WRN_MissingXMLComment\n\n var actual = GetDocumentationCommentText(comp,\n // (2,14): warning CS1591: Missing XML comment for publicly visible type or member 'C'\n // public class C { }\n Diagnostic(ErrorCode.WRN_MissingXMLComment, \"C\").WithArguments(\"C\")); //Filtering happens later.\n var expected = (@\"\n\n\n \n Test\n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [WorkItem(531233, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531233\")]\n [Fact]\n public void CrefAttributeInOtherElement()\n {\n var source = @\"\nclass C\n{\n /// \n void M()\n {\n }\n}\n\";\n var comp = CreateCompilationUtil(source);\n comp.VerifyDiagnostics();\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [WorkItem(531233, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531233\")]\n [Fact]\n public void NameAttributeInOtherElement()\n {\n var source = @\"\nclass C\n{\n /// \n void M()\n {\n }\n}\n\";\n var comp = CreateCompilationUtil(source);\n comp.VerifyDiagnostics();\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void GetParseDiagnostics()\n {\n var source = @\"\nclass Program\n{\n /// \n /// \n static void Main(string[] args)\n {\n }\n}\";\n var comp = CreateCompilationUtil(source);\n Assert.NotEmpty(comp.GetParseDiagnostics());\n Assert.Empty(comp.GetDeclarationDiagnostics());\n Assert.Empty(comp.GetMethodBodyDiagnostics());\n Assert.NotEmpty(comp.GetDiagnostics());\n }\n\n [WorkItem(531349, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531349\")]\n [Fact]\n public void GetDeclarationDiagnostics()\n {\n var source = @\"\nclass Program\n{\n /// \n /// \n /// \n /// \n static void Main(string[] args)\n {\n }\n}\";\n var comp = CreateCompilationUtil(source);\n Assert.Empty(comp.GetParseDiagnostics());\n Assert.Empty(comp.GetDeclarationDiagnostics());\n Assert.Equal(2, comp.GetMethodBodyDiagnostics().Count());\n Assert.Equal(2, comp.GetDiagnostics().Count());\n }\n\n [WorkItem(531409, \"http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531409\")]\n [Fact]\n public void ExplicitInterfaceImplementation()\n {\n var source = @\"\ninterface I\n{\n void M();\n}\n\nclass C : I\n{\n /// \n void I.M() { }\n}\n\";\n var comp = CreateCompilationUtil(source);\n comp.VerifyDiagnostics();\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n [Fact]\n public void ArrayRankSpecifierOrder()\n {\n var source = @\"\nclass C\n{\n /// \n int[][,] M(int[,][] x) { return null; }\n}\n\";\n var comp = CreateCompilationUtil(source);\n comp.VerifyDiagnostics();\n\n var actual = GetDocumentationCommentText(comp);\n var expected = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(expected, actual);\n }\n\n // As in dev11, the pragma has no effect.\n [ClrOnlyFact(ClrOnlyReason.DocumentationComment, Skip = \"https://github.com/dotnet/roslyn/issues/8807\")]\n public void PragmaDisableWarningInXmlFile()\n {\n var xmlFile = Temp.CreateFile(extension: \".xml\").WriteAllText(\"&\");\n\n var sourceTemplate = @\"\n#pragma warning disable 1592\n/// \nclass C {{ }}\n\";\n var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFile.Path));\n\n var actual = GetDocumentationCommentText(comp,\n // 054c2dcb7959.xml(1,1): warning CS1592: Badly formed XML in included comments file -- 'Data at the root level is invalid.'\n Diagnostic(ErrorCode.WRN_XMLParseIncludeError).WithArguments(\"Data at the root level is invalid.\"));\n var expectedTemplate = (@\"\n\n\n \n Test\n \n \n \n \n \n \n\n\").Trim();\n Assert.Equal(string.Format(expectedTemplate, TestHelpers.AsXmlCommentText(xmlFile.Path)), actual);\n }\n\n [Fact]\n public void DynamicInParameters()\n {\n // BREAK: Dev11 drops candidates with \"dynamic\" anywhere in their parameter lists.\n // As a result, it does not match the first two or last two crefs.\n\n var source = @\"\n/// \n/// \n/// \n/// \n/// \n/// \n/// \n/// \n/// \nclass C\n{\n void M1(dynamic p) { }\n void M1(C